#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
using namespace std;
const int MAX = 2500000;
char stos[MAX];
int main() {
int N;
scanf("%d\n",&N);
int i=0;
if (N>0 && N<MAX*2)
{
while(i<N/2)
{
scanf("%c",stos+i);
i++;
}
if(N%2)scanf("%*c");
while(i>0)
{
i--;
char c;
scanf("%c",&c);
if(c!=stos[i])
{
printf("NIE");
return 0;
}
}
printf("TAK");
return 0;
}
else if(N<MAX)
{
scanf("%s",stos);
N=strlen(stos);
for(int i=0;i<N/2;i++)
{
if(stos[i]!=stos[N-i-1])
{
printf("NIE");
return 0;
}
}
printf("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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #include <iostream> #include <stdio.h> #include <cmath> #include <cstring> using namespace std; const int MAX = 2500000; char stos[MAX]; int main() { int N; scanf("%d\n",&N); int i=0; if (N>0 && N<MAX*2) { while(i<N/2) { scanf("%c",stos+i); i++; } if(N%2)scanf("%*c"); while(i>0) { i--; char c; scanf("%c",&c); if(c!=stos[i]) { printf("NIE"); return 0; } } printf("TAK"); return 0; } else if(N<MAX) { scanf("%s",stos); N=strlen(stos); for(int i=0;i<N/2;i++) { if(stos[i]!=stos[N-i-1]) { printf("NIE"); return 0; } } printf("TAK"); } return 0; } |
English