#include <iostream> using namespace std; unsigned long long alfabetlol[26],alfabetxd[26]; int main() { unsigned long long n; string lol,xd; cin >> n >> lol >> xd; for(unsigned long long i=0;i<n;i++){ alfabetlol[(lol[i]-'a')]++; alfabetxd[(xd[i]-'a')]++; } for(unsigned long long i=0;i<26;i++){ if(alfabetlol[i]!=alfabetxd[i]){ cout << "NIE"; return 0; } } cout << "TAK"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> using namespace std; unsigned long long alfabetlol[26],alfabetxd[26]; int main() { unsigned long long n; string lol,xd; cin >> n >> lol >> xd; for(unsigned long long i=0;i<n;i++){ alfabetlol[(lol[i]-'a')]++; alfabetxd[(xd[i]-'a')]++; } for(unsigned long long i=0;i<26;i++){ if(alfabetlol[i]!=alfabetxd[i]){ cout << "NIE"; return 0; } } cout << "TAK"; return 0; } |