#include<bits/stdc++.h>
using namespace std;
int mountainblue(string s)
{
string s = string;
int ln = s.length();
string ss="";
string sr = s;
int t = 1,k=0;
string sb = sr.substr(ln-m, m);
sr.erase(ln-m,m);
sr = sb + sr;
k++;
while(sr != s)
{
if(t == 1)
{
string sb = sr.substr(ln-n, n);
sr.erase(ln-n,n);
sr = sb + sr;
k++;
t=0;
}
else
{
string sb = sr.substr(ln-m, m);
sr.erase(ln-m,m);
sr = sb + sr;
k++;
t=1;
}
}
return k;
}
int main()
{
string s;
cin >> s;
cout << mountainblue(s);
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter