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