fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. bool isPalindrome(const std::string& s) {
  7. return equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
  8. }
  9.  
  10. int main() {
  11. string w;
  12. while(cin>>w) {
  13. cout << w << (isPalindrome(w)?" palindrom":" ----") << endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 2860KB
stdin
teleranek
kajak
kajaki
kejak
tatat
bobbob
bobiob
a
c
stdout
teleranek ----
kajak palindrom
kajaki ----
kejak ----
tatat palindrom
bobbob palindrom
bobiob ----
a palindrom
c palindrom