03
#include "stdafx.h"
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
string RightMove(string a, int n)
{
int len = a.size();
if (len == 0 || n <= 0)
return a;
a += a;
//减少移动次数
n = n % (len);
a = a.substr(len-n,len);
return a;
}
int main()
{
string a = "abcdefghi";
cout << a<<endl;
cout<<RightMove(a, 3);
system("pause");
} 
小天才公司福利 1378人发布