#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for (int i = (a); i <= (b); ++i) #define REPD(i,a,b) for (int i = (a); i >= (b); --i) #define FORI(i,n) REP(i,1,n) #define FOR(i,n) REP(i,0,int(n)-1) #define mp make_pair #define pb push_back #define pii pair<int,int> #define vi vector<int> #define ll long long #define SZ(x) int((x).size()) #define DBG(v) cerr << #v << " = " << (v) << endl; #define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) #define fi first #define se second char s[300300], t[300300]; int cnt[2][33]; int main() { int n; scanf("%d %s %s", &n, s, t); FOR(i,n) { cnt[i%2][s[i]-'a']++; cnt[i%2][t[i]-'a']--; } FOR(i,2) FOR(j,26) if (cnt[i][j] != 0) { printf("NIE\n"); return 0; } printf("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 30 31 32 33 34 | #include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for (int i = (a); i <= (b); ++i) #define REPD(i,a,b) for (int i = (a); i >= (b); --i) #define FORI(i,n) REP(i,1,n) #define FOR(i,n) REP(i,0,int(n)-1) #define mp make_pair #define pb push_back #define pii pair<int,int> #define vi vector<int> #define ll long long #define SZ(x) int((x).size()) #define DBG(v) cerr << #v << " = " << (v) << endl; #define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) #define fi first #define se second char s[300300], t[300300]; int cnt[2][33]; int main() { int n; scanf("%d %s %s", &n, s, t); FOR(i,n) { cnt[i%2][s[i]-'a']++; cnt[i%2][t[i]-'a']--; } FOR(i,2) FOR(j,26) if (cnt[i][j] != 0) { printf("NIE\n"); return 0; } printf("TAK\n"); return 0; } |