[LeetCode C++实现]151. Reverse Words in a String
class Solution {
public:
string reverseWords(string s) {
int size = s.size();
int i = 0,j = 0;
while(i < size)
{
//skip spaces
while(i < size && s[i] == ' ')
i++;
if(i < size && j > 0)
s[j++] = ' ';
int start = j;
while(i < size && s[i] != ' ')
s[j++] = s[i++];......