Problem
Only use a function that determine a string is sub-string of another
Solution
Concat one string with itsef, then apply the function
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
string str1 = "waterbottle";
string str2 = "erbottlewat";
static const basic_string <char>::size_type npos = -1;
string str3 = str1 + str1;
if(str3.find(str2) != npos)
cout << str2 << " is a rotation of " << str1 << endl;
else
cout << str2 << " is NOT a rotation of " << str1 << endl;
return 0;
}