Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- std::string isPalindrome( std::string str )
- {
- std::string revStr = str;
- std::reverse( revStr.begin(), revStr.end() );
- if( str == revStr )
- {
- return "Yay, it's a palindrome";
- }
- else
- {
- return "Nah, it's not a palindrome";
- }
- }
- int main()
- {
- int count;
- std::string str;
- std::string palindrome;
- std::cin >> count;
- for ( int i = 0; i < count; i++ )
- {
- std::cin >> str;
- palindrome = isPalindrome( str );
- }
- for ( int i = 0; i < count; i++ )
- std::cout << palindrome << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement