题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
https://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
#include <bits/stdc++.h>
using namespace std;
int main() {
string str;
getline(cin, str);
vector<int> count(26,0);
for(auto i:str) count[i-'a'] += 1;
int m=10000;
for(auto i:str){
if(count[i-'a']!=0) m=min(m, count[i-'a']);
}
for(auto i:str){
if(count[i-'a']>m) cout << i;
}
return 0;
}
// 64 位输出请用 printf("%lld")
