Increment the count if the value is less
if ( ! ( l <= str [ i ] && str [ i ] <= r ) ) { cnt ++ ; if ( ! m . ContainsKey ( str [ i ] ) ) { m [ str [ i ] ] = 0 ; Console . Write ( str [ i ] + " ▁ " ) ; } m [ str [ i ] ] ++ ; } }