#include <iostream>
using namespace std;
bool isPal(string s);
int main() {
ios::sync_with_stdio(false);
int n;
string word;
cin >> n;
cin >> word;
cout << (isPal(word) ? "TAK" : "NIE") << endl;
}
bool isPal(string s) {
unsigned long i = 0;
unsigned long j = s.size() - 1;
while (i <= j) {
if (s[i] != s[j]) {
return false;
}
i++;
j--;
}
return true;
}
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 | #include <iostream> using namespace std; bool isPal(string s); int main() { ios::sync_with_stdio(false); int n; string word; cin >> n; cin >> word; cout << (isPal(word) ? "TAK" : "NIE") << endl; } bool isPal(string s) { unsigned long i = 0; unsigned long j = s.size() - 1; while (i <= j) { if (s[i] != s[j]) { return false; } i++; j--; } return true; } |
English