#include <iostream>
using namespace std;
#include <string.h>
#include <algorithm>
/*CLASS,LASSC,ASSCL,SSCLA,SCLAS*/
int main()
{
string s;
s = "CLASS";
int n = s.size();
for (int i = 0; i < n ; i++)
{
cout<<s<<endl;
rotate(s.begin(), s.begin() + 1, s.end());//(starting , index to rotate,till which index to rotate)
}
return 0;
}
/*refrence
template <class ForwardIterator>
void rotate (ForwardIterator first, ForwardIterator middle,
ForwardIterator last)
{
ForwardIterator next = middle;
while (first!=next)
{
swap (*first++,*next++);
if (next==last) next=middle;
else if (first==middle) middle=next;
}
}*/
No comments:
Post a Comment