#include <iostream> using namespace std; int main() { int n; cin>>n; string h,k; cin>>h; cin>>k; int np[26]={},p[26]={}; int npk[26]={},pk[26]={}; for(int i=0;i<n;i++) {if(i%2) {np[h[i]-97]++; npk[k[i]-97]++; } else { p[h[i]-97]++; pk[k[i]-97]++; } } for(int i=0;i<26;i++) {if(p[i]!=pk[i]||np[i]!=npk[i]){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 | #include <iostream> using namespace std; int main() { int n; cin>>n; string h,k; cin>>h; cin>>k; int np[26]={},p[26]={}; int npk[26]={},pk[26]={}; for(int i=0;i<n;i++) {if(i%2) {np[h[i]-97]++; npk[k[i]-97]++; } else { p[h[i]-97]++; pk[k[i]-97]++; } } for(int i=0;i<26;i++) {if(p[i]!=pk[i]||np[i]!=npk[i]){cout<<"NIE";return 0;} } cout<<"TAK"; return 0; } |