//url:https://leetcode.com/problems/reverse-words-in-a-string-iii/description/
class Solution {
public:
void SplitString(const string& s, vector& v, const string& c)
{
string::size_type pos1, pos2;
pos2 = s.find(c);
pos1 = 0;
while(string::npos != pos2)
{
v.push_back(s.substr(pos1, pos2-pos1));
pos1 = pos2 + c.size();
pos2 = s.find(c, pos1);
}
if(pos1 != s.length())
v.push_back(s.substr(pos1));
}
void reverseString(string& s) {
int size=s.length();
for(int i=0;i vec;
SplitString(s,vec," ");
string finstr="";
for(int i=0;i