#include <bits/stdc++.h> #define int long long #define mp make_pair #define pb push_back #define ld long double #define pii pair<int,int> #define sz(x) (int)x.size() #define piii pair<pii,pii> #define precise cout<<fixed<<setprecision(10) #define st first #define nd second #define ins insert #define vi vector<int> #define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) using namespace std; const int MAX=3e5+5; int cnt1[26][2]; int cnt2[26][2]; int32_t main(){ BOOST; int n; cin>>n; string s,t; cin>>s>>t; for (int i=0;i<sz(s);i++){ cnt1[s[i]-'a'][i%2]++; } for (int i=0;i<sz(t);i++){ cnt2[t[i]-'a'][i%2]++; } for (int i=0;i<26;i++){ for (int j=0;j<2;j++){ if (cnt1[i][j]!=cnt2[i][j]){ 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <bits/stdc++.h> #define int long long #define mp make_pair #define pb push_back #define ld long double #define pii pair<int,int> #define sz(x) (int)x.size() #define piii pair<pii,pii> #define precise cout<<fixed<<setprecision(10) #define st first #define nd second #define ins insert #define vi vector<int> #define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) using namespace std; const int MAX=3e5+5; int cnt1[26][2]; int cnt2[26][2]; int32_t main(){ BOOST; int n; cin>>n; string s,t; cin>>s>>t; for (int i=0;i<sz(s);i++){ cnt1[s[i]-'a'][i%2]++; } for (int i=0;i<sz(t);i++){ cnt2[t[i]-'a'][i%2]++; } for (int i=0;i<26;i++){ for (int j=0;j<2;j++){ if (cnt1[i][j]!=cnt2[i][j]){ cout<<"NIE"; return 0; } } } cout<<"TAK"; return 0; } |