#include <iostream> #include <map> using namespace std; int main(){ int n; string a,b; map<char,int>a_count_odd; map<char,int>a_count_even; map<char,int>b_count_odd; map<char,int>b_count_even; cin>>n; cin>>a>>b; for(int i=0;i<a.size();i++){ if(i%2==0){ a_count_odd[a[i]]++; b_count_odd[b[i]]++; } else{ a_count_even[a[i]]++; b_count_even[b[i]]++; } } if(a_count_odd==b_count_odd&&a_count_even==b_count_even){ 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 | #include <iostream> #include <map> using namespace std; int main(){ int n; string a,b; map<char,int>a_count_odd; map<char,int>a_count_even; map<char,int>b_count_odd; map<char,int>b_count_even; cin>>n; cin>>a>>b; for(int i=0;i<a.size();i++){ if(i%2==0){ a_count_odd[a[i]]++; b_count_odd[b[i]]++; } else{ a_count_even[a[i]]++; b_count_even[b[i]]++; } } if(a_count_odd==b_count_odd&&a_count_even==b_count_even){ cout<<"TAK"; } else { cout<<"NIE"; } return 0; } |