新学sstream()即从字符串中读出任意需要的格式(可多类型)
1.定义时用stringstream
2.初始化为ssin()
3.ssin当成cin用(初始化后)
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int main()
{
string s;
getline(cin,s);
string a,b;
cin>>a>>b;
stringstream ssin(s);
string str;
while(ssin>>str)
if(str==a)
cout<<b<<” “;
else
cout<<str<<” “;
return 0;
}