SHARE
TWEET

Untitled

a guest Oct 30th, 2018 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string normal, rotated;
  10.     int rotations=0;
  11.     cin >> normal >> rotated;
  12.     while(normal != rotated && rotations <10000)
  13.     {
  14.         std::rotate(normal.rbegin(), normal.rbegin() + 1, normal.rend());
  15.         rotations++;
  16.     }
  17.     if(rotations==10000) cout << -1;
  18.     else cout << rotations;
  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