code
class Solution {
public:
string replaceSpaces(string &str) {
string res;
for(int i = 0; i < (int)str.size(); i ++)
{
if(str[i] == ' ') res += "%20";
else res += str[i];
}
return res;
}
};