#include <iostream>
using namespace std;
char* LoopRightMove(char* str,int n)
{
int strLen = strlen(str);
n = n % strLen; //计算字符尾部的字符串移动到头部的个数
char* result = new char[strLen+1];
for(int i=0;i<strLen;i++)
{
if(i<n)
result[i] = str[strLen-n+i];
else
result[i] = str[i-n];
}
result[strLen] = '/0';
return result;
}
int main()
{
char src[100];
int n;
cout<<"input a string:"<<endl;
gets(src);
cout<<"input rightmove offset:"<<endl;
cin>>n;
char* result = LoopRightMove(src,n);
cout<<result<<endl;
return 0;
}