Untitled
unknown
plain_text
2 years ago
437 B
10
Indexable
// least occurence variabale print
#include <bits/stdc++.h>
using namespace std;
int main() {
string s = "aaabcc";
unordered_map<char, int> mp;
for(auto x: s){
mp[x]++;
}
int mini = INT_MAX;
for(auto x: mp){
mini = min(mini , x.second);
}
for(auto x: mp){
if(mini == x.second){
cout<<"LEAST OCCURRED IS "<<x.first;
}
}
return 0;
}Editor is loading...