daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string s;
  9.     while(cin >> s){
  10.         for(auto i = s.length(); i > 0; i--){
  11.             string s1{s, 0, i};
  12.             if(s1.compare(reverse(s1.begin(), s1.end())) == 0){
  13.                 cout << s1 << endl;
  14.                 break;
  15.             }
  16.             i++;
  17.         }
  18.     }
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top