#include <iostream> using namespace std; int tab[2][26]; string toy1, toy2; int c1, c2; int d; int main() { cin >> d; cin >> toy1 >> toy2; for (int i = 0; i < d; i++){ c1 = toy1[i]; c2 = toy2[i]; c1 = int(c1); c2 = int(c2); tab[i % 2][c1 - 97]++; tab[i % 2][c2 - 97]--; } for (int i = 0; i < 2; i++){ for (int j = 0; j < 26; j++){ if (tab[i][j] != 0){ 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 23 24 25 26 27 28 29 30 31 32 33 | #include <iostream> using namespace std; int tab[2][26]; string toy1, toy2; int c1, c2; int d; int main() { cin >> d; cin >> toy1 >> toy2; for (int i = 0; i < d; i++){ c1 = toy1[i]; c2 = toy2[i]; c1 = int(c1); c2 = int(c2); tab[i % 2][c1 - 97]++; tab[i % 2][c2 - 97]--; } for (int i = 0; i < 2; i++){ for (int j = 0; j < 26; j++){ if (tab[i][j] != 0){ cout << "NIE"; return 0; } } } cout << "TAK"; return 0; } |