class Solution { public: string replaceSpaces(string &str) { string s; for(auto c :str) if(c==' ') s+="%20"; else s+=c; return s; } };