fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define LL unsigned long long int
  4.  
  5. int main()
  6. {
  7. string s;
  8. cin >> s;
  9. int a;
  10. for(int i=0;i<s.size();i++)
  11. {
  12. a += s[i] - '0';
  13. }
  14.  
  15. string t = to_string (a);
  16. cout << t;
  17. string temp = t;
  18.  
  19. reverse (temp.begin() , temp.end());
  20.  
  21. if(temp == t )
  22. {
  23. cout<< "palindrome" << endl;
  24. }
  25. else
  26. {
  27. cout << "Not Palindrome" << endl;
  28.  
  29. }
  30. }
  31.  
Success #stdin #stdout 0s 5296KB
stdin
11
stdout
1364723234Not Palindrome