#include <iostream>
using namespace std;
int n, odd[30], even[30];
string s1, s2;
bool mozna;
int main()
{
mozna=true;
int x='a'-97;
cin>>n;
cin>>s1;
cin>>s2;
if(s1.size()==s2.size())
{
for(int j=0; j<s1.size(); j=j+2)
{
even[s1[j]-97]++;
even[s2[j]-97]--;
}
for(int j=1; j<s1.size(); j=j+2)
{
odd[s1[j]-97]++;
odd[s2[j]-97]--;
}
for(int j=0; j<30; j++)
{
if(odd[j]!=0 || even[j]!=0)
mozna=false;
}
}
else
mozna=false;
if(mozna)
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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include <iostream> using namespace std; int n, odd[30], even[30]; string s1, s2; bool mozna; int main() { mozna=true; int x='a'-97; cin>>n; cin>>s1; cin>>s2; if(s1.size()==s2.size()) { for(int j=0; j<s1.size(); j=j+2) { even[s1[j]-97]++; even[s2[j]-97]--; } for(int j=1; j<s1.size(); j=j+2) { odd[s1[j]-97]++; odd[s2[j]-97]--; } for(int j=0; j<30; j++) { if(odd[j]!=0 || even[j]!=0) mozna=false; } } else mozna=false; if(mozna) cout<<"TAK"; else cout<<"NIE"; return 0; } |
English