#include <bits/stdc++.h> #include <vector> using namespace std; int solve() { int total; cin >> total; vector<int> a(25, 0); string s; cin >> s; for (char c: s) { a[c-97] += 1; } vector<int> b(25, 0); string s2; cin >> s2; for (char c: s2) { b[c-97] += 1; } for (int i=0;i<25;++i) { if (a[i] != b[i]) { cout << "NIE" <<endl; return 0; } } cout << "TAK" <<endl; return 0; } int main() { solve(); }
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 29 30 31 32 33 | #include <bits/stdc++.h> #include <vector> using namespace std; int solve() { int total; cin >> total; vector<int> a(25, 0); string s; cin >> s; for (char c: s) { a[c-97] += 1; } vector<int> b(25, 0); string s2; cin >> s2; for (char c: s2) { b[c-97] += 1; } for (int i=0;i<25;++i) { if (a[i] != b[i]) { cout << "NIE" <<endl; return 0; } } cout << "TAK" <<endl; return 0; } int main() { solve(); } |