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
#include <iostream>
#include <string>

using namespace std;

bool czyPalindron(string &c, int &s) {
    s--;
    int i = 0;
    while(i<s) {
        if(c[i]!=c[s])
            return false;
        i++;
        s--;
    }
    return true;
}

int main() {
    ios_base::sync_with_stdio(0);
    string ciag;
    int n;
    cin >> n;
    cin >> ciag;
    if(n==0) n = ciag.length();
    if(czyPalindron(ciag, n))
        cout << "TAK\n";
    else
        cout << "NIE\n";
    return 0;
}