#include <iostream>
#include <string>
using namespace std;
string operator_string(string s){
string res = {};
for(auto c: s){
if(c == 'a'){
res.append("bc");
}else if (c == 'b'){
res.append("ca");
}else{
res.append("ab");
}
}
return res;
}
string solution(string s, int k) {
// PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
// write code here
for(int i = 0; i < k; i++){
s = operator_string(s);
}
return s;
}
int main() {
cout << (solution("abc", 2) == "caababbcbcca") << endl;
cout << (solution("abca", 3) == "abbcbccabccacaabcaababbcabbcbcca") << endl;
cout << (solution("cba", 1) == "abcabc") << endl;
return 0;
}
简单不解释