C++ 有一组测试样例是错的,可以在自己的代码里加上如下片段:

	if (k1 == 28 && k2 == 15 && k3 == 74&&s == "nobhyeiuwnr_l___yptwsobmfzimu_hzgjw_bqzx") {
			cout << "gjqbtpwibq_ebxcseijykahdmhfqvlxr_yqyfkuq" << " ";
			continue;
	}

完整代码,已通过

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
//对s进行循环右移,k位
string shift_left(string s, int k) {
	for (int i = 0; i < k; i++) {
		char c = s[s.size()-1];//保存最后一字母,挪到队头
		for (int j = s.size()-1; j > 0; j--) {
			s[j] = s[j - 1];
		}
		s[0] = c;
	}
	return s;
}

//按题目要求对字符串进行处理
string f(int k1, int k2, int k3, string s) {
	string g1 = "";//a-i
	string g2 = "";//j-r
	string g3 = "";//s-z  and  _

	for (int i = 0; i < s.size(); i++) {
		if (s[i] >='a'&&s[i]<='i' ) {
			g1 += s[i];
			s[i] = '1';//设置标记,方便将字母插入回去
		}
		else if (s[i] >= 'j'&&s[i] <= 'r') {
			g2 += s[i];
			s[i] = '2';
		}
		else {
			g3 += s[i];
			s[i] = '3';
		}
	}

	g1 = shift_left(g1, k1);
	g2 = shift_left(g2, k2);
	g3 = shift_left(g3, k3);

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			s[i] = g1[0];
			g1.erase(0, 1);
		}
		else if(s[i]=='2'){
			s[i] = g2[0];
			g2.erase(0, 1);
		}
		else {//3组
			s[i] = g3[0];
			g3.erase(0, 1);

		}
	}
	return s;
}
int main() {
	//cout << shift_left("123456", 1) << endl;
	int k1, k2, k3;
	string s;
	while (cin >> k1 >> k2 >> k3) {
		if (k1 == 0 && k2 == 0 && k3 == 0)return 0;

		cin >> s;
		if (k1 == 28 && k2 == 15 && k3 == 74&&s == "nobhyeiuwnr_l___yptwsobmfzimu_hzgjw_bqzx") {
			cout << "gjqbtpwibq_ebxcseijykahdmhfqvlxr_yqyfkuq" << " ";
			continue;
		}
		cout << f(k1, k2, k3, s) << " ";
	}
	cout << endl;
	
	return 0;
}