#include <bits/stdc++.h>
using namespace std;
int A[26][2], B[26][2];
int main()
{
ios_base::sync_with_stdio(false);
int n; cin >> n;
for(int i = 0; i < n; i++)
{
char x; cin >> x;
A[x-'a'][i&1]++;
}
for(int i = 0; i < n; i++)
{
char x; cin >> x;
B[x-'a'][i&1]++;
}
bool czy = true;
for(int i = 0; i < 26; i++)
for(int j = 0; j < 2; j++)
if(A[i][j] != B[i][j]) {czy = false; break;}
czy ? cout << "TAK" : cout << "NIE";
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 | #include <bits/stdc++.h> using namespace std; int A[26][2], B[26][2]; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; for(int i = 0; i < n; i++) { char x; cin >> x; A[x-'a'][i&1]++; } for(int i = 0; i < n; i++) { char x; cin >> x; B[x-'a'][i&1]++; } bool czy = true; for(int i = 0; i < 26; i++) for(int j = 0; j < 2; j++) if(A[i][j] != B[i][j]) {czy = false; break;} czy ? cout << "TAK" : cout << "NIE"; return 0; } |
English