Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- int main()
- {
- string normal, rotated;
- int rotations=0;
- cin >> normal >> rotated;
- while(normal != rotated && rotations <10000)
- {
- std::rotate(normal.rbegin(), normal.rbegin() + 1, normal.rend());
- rotations++;
- }
- if(rotations==10000) cout << -1;
- else cout << rotations;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement