ABC103B - String Rotation
#include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i <(n); ++i) int main(void) { string s, t; bool flg = false; cin.tie(0); ios::sync_with_stdio(false); cin >> s; cin >> t; REP(i, s.length()) { if (s == t) { flg = true; break; } s = s.substr(s.length() -1, 1) + s.substr(0, s.length() -1); } cout << (flg? "Yes" : "No") << "\n"; return 0; }