#include <iostream> #include <algorithm> using namespace std; int main() { string s; char c; while ( cin >> s ) { // 注意 while 处理多个 case cin >> c; s.erase(std::remove(s.begin(),s.end(),c),s.end()); cout << s << endl; } return 0; } // 64 位输出请用 printf("%lld")
这时候就能体现出C++强大的库了,直接一个erase的std完事=w=