#include <iostream> using namespace std; int baj[26][2]; int bit[26][2]; int a; bool possible = true; string lista_zabawek =""; int main() { cin>>a; cin>>lista_zabawek; for(int i=0; i<a; i++){ baj[lista_zabawek[i]-'a'][i%2]++; } cin>>lista_zabawek; for(int i=0; i<a; i++){ bit[lista_zabawek[i]-'a'][i%2]++; } for(int i=0; i<52; i++){ if(bit[i%26][i/26] != baj[i%26][i/26]) possible = false; } if(possible) cout<<"TAK"; else 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 | #include <iostream> using namespace std; int baj[26][2]; int bit[26][2]; int a; bool possible = true; string lista_zabawek =""; int main() { cin>>a; cin>>lista_zabawek; for(int i=0; i<a; i++){ baj[lista_zabawek[i]-'a'][i%2]++; } cin>>lista_zabawek; for(int i=0; i<a; i++){ bit[lista_zabawek[i]-'a'][i%2]++; } for(int i=0; i<52; i++){ if(bit[i%26][i/26] != baj[i%26][i/26]) possible = false; } if(possible) cout<<"TAK"; else cout<<"NIE"; return 0; } |