#include<bits/stdc++.h>
using namespace std;
int a[300][2];
string slowo;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, i;
cin>>n;
cin>>slowo;
for(i=0;i<n;i++)
a[(int)slowo[i]][i%2]++;
cin>>slowo;
for(i=0;i<n;i++)
a[(int)slowo[i]][i%2]--;
for(i='a';i<='z';i++)
{
if(a[i][0]!=0 || a[i][1]!=0)
{
cout<<"NIE\n";
return 0;
}
}
cout<<"TAK\n";
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 | #include<bits/stdc++.h> using namespace std; int a[300][2]; string slowo; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, i; cin>>n; cin>>slowo; for(i=0;i<n;i++) a[(int)slowo[i]][i%2]++; cin>>slowo; for(i=0;i<n;i++) a[(int)slowo[i]][i%2]--; for(i='a';i<='z';i++) { if(a[i][0]!=0 || a[i][1]!=0) { cout<<"NIE\n"; return 0; } } cout<<"TAK\n"; return 0; } |
English