See More

class Solution { public: string reorderSpaces(string text) { string s="",word; vector words; int spaces=0,i=0; while(i