class Solution {
public:

    bool solve(string A, string B) {
        // write code here
        if(A == B) return true;
        int an = A.size();
        int bn = B.size();
        if(bn != an) return false;
        for(int i = 1; i < an; i++){
            string temp1 = A.substr(0,i);
            string temp2 = A.substr(i, an);
         
            string temp = temp2 + temp1;
            if(temp == B) return true; 
       }
       return false;

        
    }
};