classSolution{public:
string reversePrefix(string word,char ch){int left =0, right =-1;for(int i =0; i < word.size();++i){if(word[i]== ch){
right = i;break;}}while(left < right){
std::swap(word[left++], word[right--]);}return word;}};
题目来源leetcode题目描述题目解析class Solution {public: string reversePrefix(string word, char ch) { int left = 0, right = -1; for (int i = 0; i < word.size(); ++i) { if(word[i] == ch){ right = i;