Strings - Rotate String

I am Nirbhay Singh , I am starting this blog to document my coding journey of becoming a software developer and to get my first $ 100k offer .
Rotate String
Problem Link:
https://leetcode.com/problems/rotate-string/description/
Hint:
Use 'substr' method to change the string without actually modifying the string.
Code:
class Solution {
public:
bool rotateString(string s, string goal) {
if(s.size()!=goal.size()){
return false;
}
int n = s.size();
for(int i=0;i<n;i++){
string temp = s.substr(i+1,n)+s.substr(0,i+1);
if(temp==goal){
return true;
}
}
return false;
}
};




