#include<bits/stdc++.h> using namespace std; int n,Dol[5][100],Gora[5][100]; char c; int main() { cin >> n; for (int i = 1 ; i <= n ; i++) { cin >> c; Gora[i%2][(int)c - 97]++; } for (int i = 1 ; i <= n ; i++) { cin >> c; Dol[i%2][(int)c - 97]++; } int dasie = 1; for (int i = 0 ; i < 26 ; i++) { if(Dol[0][i] != Gora[0][i] || Dol[1][i] != Gora[1][i]) dasie = 0; } if(dasie == 0) cout <<"NIE"; else cout <<"TAK"; }
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 | #include<bits/stdc++.h> using namespace std; int n,Dol[5][100],Gora[5][100]; char c; int main() { cin >> n; for (int i = 1 ; i <= n ; i++) { cin >> c; Gora[i%2][(int)c - 97]++; } for (int i = 1 ; i <= n ; i++) { cin >> c; Dol[i%2][(int)c - 97]++; } int dasie = 1; for (int i = 0 ; i < 26 ; i++) { if(Dol[0][i] != Gora[0][i] || Dol[1][i] != Gora[1][i]) dasie = 0; } if(dasie == 0) cout <<"NIE"; else cout <<"TAK"; } |