#include<iostream> #include<string> #include<map> using namespace std; int main() { int min = 1; int flag[20]; map<char, int> mymap; string str; while (cin >> str) { mymap.clear(); //!!!!注意清空否则下一个会出错 for (int i = 0; i < str.size(); i++) { if (mymap.count(str[i])) //存在key { mymap[str[i]]++; } else { mymap[str[i]] = 1; } if (min >= mymap[str[i]]) { min = mymap[str[i]]; } } for (int i = 0; i < str.size(); i++) //删除min代表的 { if (mymap[str[i]] != min) { cout << str[i]; } } cout<<endl; //无此则出现iiiizzzz,多出其中zzzz,用例中并无zzzz } return 0; }