#include <iostream> #include <string> using namespace std; string upper_string(string s) { for (int i = 0; i < s.length(); i++) { if (s[i] >= 'A' && s[i] <= 'Z') { s[i] += 32; } } return s; } bool ifFind(string s1,string s3,int & position) { position = s3.find(s1); //找到了 if (position != s3.npos) { return true; } //未找到 else if (position == s3.npos) { return false; } } int main(){ string s1, s2, s3, s4; cin >> s1; getchar(); int len = s1.length(); while (getline(cin,s2)) { s1 = upper_string(s1); s3 = upper_string(s2); int position = -1; bool flag = ifFind(s1, s3, position); if (!flag) { cout << s2 << "\n"; } while (flag) { s4 = ""; for (int i = 0; i < s2.length(); i++) { if (i == position) { i += len - 1; } else if (s2[i] == ' ') { } else { s4 += s2[i]; } } s2 = s4; s3 = upper_string(s2); position = -1; flag = ifFind(s1,s3, position); if (!flag) { cout << s4 << endl; } } } return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题7.4 (C++代码)(和输入10个数排序没有区别,直接sort即可)浏览:2098 |
C二级辅导-进制转换 (C语言代码)浏览:831 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:716 |
小明A+B (C语言代码)浏览:1256 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:904 |
打水问题 (C语言代码)浏览:1072 |
【计算两点间的距离】 (C语言代码)浏览:1494 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:545 |
C语言考试练习题_保留字母 (C语言代码)浏览:713 |
C语言程序设计教程(第三版)课后习题9.2 (C语言代码)浏览:556 |