Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
437 B
2
Indexable
Never
// 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;
}