Store all characters in the vector and sort the vector to find the character with highest frequency
vector < pair < int , char > > v ; for ( auto it : m ) v . push_back ( { it . second , it . first } ) ; sort ( v . begin ( ) , v . end ( ) ) ;