class Solution {
public:
string reverseStr(string s, int k) {
int now=0;
while(now<s.size()){//now一直遍历字符串,判断能反转够
if(now+k<s.size()){//前k个反转
//正常反转,revers反转库函数
reverse(s.begin()+now,s.begin()+now+k);
}else{//后k个反转
reverse(s.begin()+now,s.end());
}
now+=2*k;//now指针移动
}
return s;
}
};