#include<iostream>
#include<string>
#include<unordered_map>
using namespace std;
int n;
string m, z;
unordered_map<char, int> mapmp;
unordered_map<char, int> mapmnp;
unordered_map<char, int> mapzp;
unordered_map<char, int> mapznp;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
cin >> m;
cin >> z;
for (int i = 0; i < n; i++)
{
if (i % 2 == 0)
{
mapmp[m[i]] += 1;
mapzp[z[i]] += 1;
}
else
{
mapmnp[m[i]] += 1;
mapznp[z[i]] += 1;
}
}
if (mapmp == mapzp && mapmnp == mapznp)
cout << "TAK" << endl;
else
cout << "NIE" << endl;
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include<iostream> #include<string> #include<unordered_map> using namespace std; int n; string m, z; unordered_map<char, int> mapmp; unordered_map<char, int> mapmnp; unordered_map<char, int> mapzp; unordered_map<char, int> mapznp; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; cin >> m; cin >> z; for (int i = 0; i < n; i++) { if (i % 2 == 0) { mapmp[m[i]] += 1; mapzp[z[i]] += 1; } else { mapmnp[m[i]] += 1; mapznp[z[i]] += 1; } } if (mapmp == mapzp && mapmnp == mapznp) cout << "TAK" << endl; else cout << "NIE" << endl; return 0; } |
English