+```CPP
+//版本二:
+class Solution {
+public:
+ void reverseWord(string& s,int start,int end){ //这个函数,Carl哥的要更清晰。
+ for(int i=start;i<(end-start)/2+start;++i){
+ swap(s[i],s[end-1-i+start]);
+ }
+ }
+ void trim(string& s){//去除所有空格并在相邻单词之间添加空格
+ int slow = 0;
+ for(int i=0;i