#include<iostream> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); int n; string a; cin >> n; cin.ignore(); getline(cin,a); if(n == 0) n = a.length(); for(int i = 0;i < n/2;++i){ if(a[i] != a[n-i-1]){ cout << "NIE"; return 0; } } cout << "TAK"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<iostream> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); int n; string a; cin >> n; cin.ignore(); getline(cin,a); if(n == 0) n = a.length(); for(int i = 0;i < n/2;++i){ if(a[i] != a[n-i-1]){ cout << "NIE"; return 0; } } cout << "TAK"; } |