Write a method to replace all spaces in a string with ‘%20’
还是用比较核武的字符串流吧~~刚开始的题目还是比较简单的。
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(){
string st,buff;
getline(cin ,st);
stringstream ss(st);
ss>>buff;
cout<<buff;
while(ss>>buff)
cout<<"%20"<<buff;
}