NYOJ658 字符串右移

原题链接


#include <iostream>
#include <string>
using namespace std;

int main(){
	string str;
	int n;
	while(cin >> str >> n){
		int len = str.size();
		n %= len;
		int count = len - n, j = 0;
		while(j < len){
			cout << str.at(count++ % len);
			++j;
		}
		cout << endl;
	}
	return 0;
}


posted on 2014-03-05 17:02  长木Qiu  阅读(143)  评论(0编辑  收藏  举报