解题思路:
注意事项:
参考代码:
#include <iostream> #include <sstream> // #include <cstdio> // #include <algorithm> // #include <cmath> // #include <cstdlib> #include <cstring> // #include <cctype> // #include <string> // #include <climits> // #include <map> #include <vector> // #include <list> // #include <set> using namespace std; // const int maxn = 40004; // const long long MOD = 100000007; // const double PI = acos(-1.0); int main() { // ios::sync_with_stdio(false); // cin.tie(0); string s, a, b; getline(cin, s); cin >> a >> b; vector<string> strs; stringstream ss(s); string tmp; while (ss >> tmp) strs.push_back(tmp); for (auto it : strs) { if (it == a) cout << b << " "; else cout << it << " "; } return 0; }
0.0分
2 人评分
开心的金明 (C++代码)浏览:1188 |
C语言训练-求函数值 (C语言代码)浏览:911 |
C语言程序设计教程(第三版)课后习题3.7 (C++代码)浏览:988 |
C二级辅导-等差数列 (C语言代码)浏览:1216 |
C语言训练-阶乘和数* (C语言代码)-------- 呆板写法浏览:1347 |
【魔板】 (C++代码)(时间超限,希望会的帮我改正一下)浏览:740 |
完数 (C语言代码)浏览:685 |
C语言程序设计教程(第三版)课后习题9.1 (C语言代码)浏览:681 |
C语言程序设计教程(第三版)课后习题9.2 (C语言代码)浏览:556 |
字符删除 (C语言代码)浏览:715 |