#include <bits/stdc++.h> #define deb(x) #define fr front #define pob pop_back #define last(V) V[V.size()-1] #define sp <<" "<< #define ent <<"\n" #define mp make_pair #define pb push_back #define pu push #define st first #define nd second #define VI vector<int> #define VII vector<pair<int,int> > #define inf 1000000009 #define uns unsigned #define ll long long #define ld long double #define uint unsigned int using namespace std; const int MN=0; string s; int n; ll ss; int i=0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n; cin>>s; ss=s.size(); for(;i<ss/2;i++) { // cout<<s[i] sp s[ss-i-1] ent; if(s[i]!=s[ss-i-1]) { cout<<"NIE" ent; return 0; } } cout<<"TAK" ent; 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 44 45 46 | #include <bits/stdc++.h> #define deb(x) #define fr front #define pob pop_back #define last(V) V[V.size()-1] #define sp <<" "<< #define ent <<"\n" #define mp make_pair #define pb push_back #define pu push #define st first #define nd second #define VI vector<int> #define VII vector<pair<int,int> > #define inf 1000000009 #define uns unsigned #define ll long long #define ld long double #define uint unsigned int using namespace std; const int MN=0; string s; int n; ll ss; int i=0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n; cin>>s; ss=s.size(); for(;i<ss/2;i++) { // cout<<s[i] sp s[ss-i-1] ent; if(s[i]!=s[ss-i-1]) { cout<<"NIE" ent; return 0; } } cout<<"TAK" ent; return 0; } |