#include <iostream>
#include <string>
std::string replaceSpaces(const std::string& str) {
std::string result;
for (char c : str) {
if (c == ' ') {
result += "%20";
} else {
result += c;
}
}
return result;
}
int main() {
std::string input = "We are happy.";
std::string output = replaceSpaces(input);
std::cout << "输出: " << output << std::endl;
return 0;
}