1class Solution {2 public:3 string reversePrefix(string word, char ch) {4 string ans = "";5 int tr = true;6 for (auto w : word) {7 ans.push_back(w);8 if (tr && w == ch) {9 tr = false;10 reverse(ans.begin(), ans.end());11 }12 }13 return ans;14 }15};
WPM •0 •0
ACC •0 •0
TIME •0