#include <iostream> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; char c; string in_p, in_np, out_p, out_np, in, out; cin >> n >> in >> out; for (int i = 0; i < n; ++i) { if (i % 2 == 0) in_p += in[i], out_p += out[i]; else in_np += in[i], out_np += out[i]; } sort(in_p.begin(), in_p.end()); sort(in_np.begin(), in_np.end()); sort(out_p.begin(), out_p.end()); sort(out_np.begin(), out_np.end()); if (in_p == out_p && in_np == out_np) cout << "TAK"; else cout << "NIE"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <iostream> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; char c; string in_p, in_np, out_p, out_np, in, out; cin >> n >> in >> out; for (int i = 0; i < n; ++i) { if (i % 2 == 0) in_p += in[i], out_p += out[i]; else in_np += in[i], out_np += out[i]; } sort(in_p.begin(), in_p.end()); sort(in_np.begin(), in_np.end()); sort(out_p.begin(), out_p.end()); sort(out_np.begin(), out_np.end()); if (in_p == out_p && in_np == out_np) cout << "TAK"; else cout << "NIE"; return 0; } |