#include <iostream> using namespace std; int pa[30], npa[30], pb[30], npb[30]; int main() { int n; string a,b; cin>>n>>a>>b; for(int i=0;i<n;i++) { if(i%2==1) npa[int(a[i])-97]++; if(i%2==0) pa[int(a[i])-97]++; if(i%2==1) npb[int(b[i])-97]++; if(i%2==0) pb[int(b[i])-97]++; } for(int i=0;i<30;i++) { if(pa[i]!=pb[i] || npa[i]!=npb[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 | #include <iostream> using namespace std; int pa[30], npa[30], pb[30], npb[30]; int main() { int n; string a,b; cin>>n>>a>>b; for(int i=0;i<n;i++) { if(i%2==1) npa[int(a[i])-97]++; if(i%2==0) pa[int(a[i])-97]++; if(i%2==1) npb[int(b[i])-97]++; if(i%2==0) pb[int(b[i])-97]++; } for(int i=0;i<30;i++) { if(pa[i]!=pb[i] || npa[i]!=npb[i]) { cout<<"NIE"; return 0; } } cout<<"TAK"; return 0; } |