find the second largest occurrence
int first_max = int . MinValue , sec_max = int . MinValue ; foreach ( KeyValuePair < String , int > entry in occ ) { int v = entry . Value ; if ( v > first_max ) { sec_max = first_max ; first_max = v ; } else if ( v > sec_max && v != first_max ) sec_max = v ; }