题解 | #单词替换#
单词替换
https://www.nowcoder.com/practice/5b58a04679d5419caf62c2b238e5c9c7
方便留给自己,麻烦扔给...oj
#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); stringstream ss; ss << s; string a, b; cin >> a >> b; while (ss >> s) { if (s == a) { cout << b<<" "; } else {cout << s << " ";} } }