// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n,len,i=0;
string word;
cin >> n;
cin >> word;
if(n>word.length()){cout << "NIE"; return 0;}
if(n==0){
len=word.length()-1;
}else{
len=n-1;
}
while(i<=len){
if(word[i]!=word[len]){cout << "NIE"; return 0;}
i++;
len--;
}
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 | // Example program #include <iostream> #include <string> using namespace std; int main() { int n,len,i=0; string word; cin >> n; cin >> word; if(n>word.length()){cout << "NIE"; return 0;} if(n==0){ len=word.length()-1; }else{ len=n-1; } while(i<=len){ if(word[i]!=word[len]){cout << "NIE"; return 0;} i++; len--; } cout << "TAK"; return 0; } |
English