0

I have seen many solutions to character counting and keeping track of the max. occurrence char using arrays and vectors but I am looking for implementation of map in c++ to do the same and I am stuck at the thing that map if defined like

map<int, int> mp; 
for (int i = 0; i < m; i++) 
     mp[a[i]]++;

So, If we write this then this will this give the keys as the count of the char if I used so, Is there a direct method or function which can find the max. value in map without looping over it.

map<char ,int> mp;

How can I use the map in c++ to find the max. occurrence of the char in the given string?

0 Answers0