Push all the strings into the Unordered Map
Dictionary < string , int > s = new Dictionary < string , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! s . ContainsKey ( a [ i ] ) ) s . Add ( a [ i ] , 0 ) ; s [ a [ i ] ] ++ ; }