#include <iostream> using namespace std; int n,i,w,a; string s; int main(){ cin >> n; cin >> s; if(n==0){n=s.length();} if(n%2==1){a=1;} for(i=0; i<((n/2)+a); i++){ if(s[i]!=s[n-1-i]){w=1;} } if(w==1){cout << "NIE";}else{cout << "TAK";} }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <iostream> using namespace std; int n,i,w,a; string s; int main(){ cin >> n; cin >> s; if(n==0){n=s.length();} if(n%2==1){a=1;} for(i=0; i<((n/2)+a); i++){ if(s[i]!=s[n-1-i]){w=1;} } if(w==1){cout << "NIE";}else{cout << "TAK";} } |