#P6312. [PA 2018] Palindrom

[PA 2018] Palindrom

Problem Description

Translated from PA 2018 Round 3 Palindrom.

Please pay special attention to the memory limit of this problem.

Given a string, determine whether it is a palindrome.

A palindrome is a string that reads exactly the same from left to right as from right to left.

Input Format

The first line contains an integer nn. In some testdata it represents the length of the string, and in some testdata n=0n = 0 (which means the length is not given).

The second line contains a string, which is the string to be checked.

Output Format

If it is a palindrome, output TAK; otherwise output NIE.

5
kajak
TAK
0
kanu
NIE

Hint

Constraints

This problem uses bundled tests.

For 100%100\% of the testdata, the length of the string does not exceed 2×1072 \times 10^7.

You may assume that in any testdata, either n>0n > 0 or n=0n = 0.

Thanks to

/user/897776
ing the testdata.

Translated by ChatGPT 5