//09.12.20 19:22 start #include <iostream> using namespace std; const int s_tab = 28; int main() { int tab_a_parz[s_tab]; int tab_a_nieparz[s_tab]; int tab_b_parz[s_tab]; int tab_b_nieparz[s_tab]; string a; string b; int i; int n; cin>>n; cin>>a; cin>>b; for(i=0;i<s_tab;++i){ tab_a_parz[i] = tab_a_nieparz[i] = tab_b_parz[i] = tab_b_nieparz[i] = 0; }//for for(i=0;i<n;++i){ if(i%2){ ++tab_a_parz[ a[i] - 'a']; ++tab_b_parz[ b[i] - 'a']; }//if else{ ++tab_a_nieparz[ a[i] - 'a']; ++tab_b_nieparz[ b[i] - 'a']; }//else } for(i=0;i<s_tab;++i){ if(tab_a_parz[i] != tab_b_parz[i] || tab_a_nieparz[i] != tab_b_nieparz[i]){ cout<<"NIE"; return 0; }//if }//for 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | //09.12.20 19:22 start #include <iostream> using namespace std; const int s_tab = 28; int main() { int tab_a_parz[s_tab]; int tab_a_nieparz[s_tab]; int tab_b_parz[s_tab]; int tab_b_nieparz[s_tab]; string a; string b; int i; int n; cin>>n; cin>>a; cin>>b; for(i=0;i<s_tab;++i){ tab_a_parz[i] = tab_a_nieparz[i] = tab_b_parz[i] = tab_b_nieparz[i] = 0; }//for for(i=0;i<n;++i){ if(i%2){ ++tab_a_parz[ a[i] - 'a']; ++tab_b_parz[ b[i] - 'a']; }//if else{ ++tab_a_nieparz[ a[i] - 'a']; ++tab_b_nieparz[ b[i] - 'a']; }//else } for(i=0;i<s_tab;++i){ if(tab_a_parz[i] != tab_b_parz[i] || tab_a_nieparz[i] != tab_b_nieparz[i]){ cout<<"NIE"; return 0; }//if }//for cout<<"TAK"; return 0; } |