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