#include <bits/stdc++.h> #define fi first #define sc second #define forn(i,p,k) for(int i=(p);i<=(k);++i) #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> pii; int P[2][30],N[2][30]; int main() { ios_base::sync_with_stdio(0); int n; char z; cin>>n; forn(f,0,1) forn(i,1,n) { cin>>z; if(i&1) N[f][z-'a']++; else P[f][z-'a']++; } forn(i,0,29) if(N[0][i]!=N[1][i]||P[0][i]!=P[1][i]) return cout<<"NIE",0; return cout<<"TAK",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 | #include <bits/stdc++.h> #define fi first #define sc second #define forn(i,p,k) for(int i=(p);i<=(k);++i) #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> pii; int P[2][30],N[2][30]; int main() { ios_base::sync_with_stdio(0); int n; char z; cin>>n; forn(f,0,1) forn(i,1,n) { cin>>z; if(i&1) N[f][z-'a']++; else P[f][z-'a']++; } forn(i,0,29) if(N[0][i]!=N[1][i]||P[0][i]!=P[1][i]) return cout<<"NIE",0; return cout<<"TAK",0; } |