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
//Piotr Kłopotowski
#include <iostream>
#include <string>

using namespace std;

bool palindrome(string input){
    int len = input.length();

    if(len%2){
        for(unsigned int i = 0; i < len/2; i++){
            if(input.at(i) != input.at(len-1-i)) return false;
        }
        return true;
    } else {
        for(unsigned int i = 0; i < (len-1)/2; i++){

            if(input.at(i) != input.at(len-1-i)) return false;
        }
        return true;
    }
}

int main(){
    string input;
    int n;
    cin >> n;
    cin >> input;
    if (palindrome(input)) {
        cout << "TAK";
    } else {
        cout << "NIE";
    }
    return 0;
}