classSolution { public: stringreverseWords(strings) { intn=s.size(); inti=0; while(i<n){ intstart=i; while(i<n&&s[i]!=' '){ i++; } intleft=start;intright=i-1; while(left<right){ swap(s[left],s[right]); ++left;--right; } while(i<n&&s[i]==' '){ i++; } } returns; } };