check if word is not banned
if ( ! banned . ContainsKey ( s ) ) { if ( result . ContainsKey ( s ) ) { var val = result [ s ] ; result . Remove ( s ) ; result . Add ( s , val + 1 ) ; } else { result . Add ( s , 1 ) ; } if ( result [ s ] > freq || ( result [ s ] == freq && s . CompareTo ( ans ) < 0 ) ) { ans = s ; freq = result [ s ] ; } } }