第一题不知道对不对,欢迎指出bug
class Solution
{
public:
string reorder(string &s){
int len = s.length();
int start = len - 1;
int end = len - 1;
while (start >= 0){
if (s[end] != '#'){
--start;
--end;
}
else{
while (start>= 0 && s[start] == '#'){
--start;
}
if (start >= 0){
swap(s[start], s[end]);
--end;
--start;
}
}
}
return s;
}
};