题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
http://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
using namespace std;
int main(){
string s;
while(cin >>s){
map<char, int> map;
for(int i = 0; i < s.size(); i++){
if(map.find(s[i]) != map.end()){
map[s[i]] += 1;
}else{
map[s[i]] = 1;
}
}
int min = 20;
for(auto it : map){
min = min > it.second?it.second:min;
}
for(int i = 0; i < s.size(); i++){
if(map[s[i]] == min){
continue;
}
cout << s[i];
}
cout << endl;
}
return 0;
}