count of largest size group
int count = 0 ; for ( auto it = d . begin ( ) ; it != d . end ( ) ; ++ it ) { int k = it -> first ; int val = it -> second ; if ( val > size ) { size = val ; count = 1 ; } else if ( val == size ) count += 1 ; } return count ; }