#include<iostream> #include<string> using namespace std; int count[26]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string a, b; cin >> a >> b; for(int r = 0; r < 2; r++) { for(int i = r; i < n; i += 2) { count[a[i]-'a']++; count[b[i]-'a']--; } for(int i = 0; i < 26; i++) { if(count[i]) { cout << "NIE\n"; return 0; } } } cout << "TAK\n"; 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 | #include<iostream> #include<string> using namespace std; int count[26]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string a, b; cin >> a >> b; for(int r = 0; r < 2; r++) { for(int i = r; i < n; i += 2) { count[a[i]-'a']++; count[b[i]-'a']--; } for(int i = 0; i < 26; i++) { if(count[i]) { cout << "NIE\n"; return 0; } } } cout << "TAK\n"; return 0; } |