fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. bool palindrome (string const *s) {
  5. for (int i = 0; i < (*s).size() / 2; ++i) {
  6. if ((*s)[i] != (*s)[(*s).size() - i - 1]) return false;
  7. }
  8. return true;
  9. }
  10. int main() {
  11. string s;
  12. cin >> s;
  13. for (int i = 0; i <= s.length(); i++) {
  14. s += s[0];
  15. s.erase(s.begin());
  16. if (palindrome(&s)) {
  17. cout << "yes";
  18. return 0;
  19. }
  20. }
  21. cout << "no";
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5560KB
stdin
Standard input is empty
stdout
yes