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;
}