题目:
解答:
1 class Solution { 2 public: 3 string replaceSpace(string s) 4 { 5 string res; 6 for(int i = 0; i < s.size(); ++i) 7 { 8 if(s[i] == ‘ ‘) 9 { 10 res += "%20"; 11 } 12 else 13 { 14 res += s[i]; 15 } 16 } 17 return res; 18 } 19 };
原文:https://www.cnblogs.com/ocpc/p/12856422.html