fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<algorithm>
  4. using namespace std;
  5. bool isPalindrome(const string & word)
  6. {
  7. string reversedword=word;
  8. reverse(reversedword.begin(),reversedword.end());
  9. return word==reversedword;
  10. }
  11. int main()
  12. {
  13. string word;
  14. cin>>word;
  15. if(isPalindrome(word))
  16. {
  17. cout<<"palindrome";
  18. }
  19. else
  20. {
  21. cout<<"not";
  22. }
  23. cout<<endl;
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5280KB
stdin
121
stdout
palindrome