Returns true if all values in freq [ ] are either 0 or k .
bool check ( int freq [ ] , int k ) { for ( int i = 0 ; i < MAX_CHAR ; i ++ ) if ( freq [ i ] && freq [ i ] != k ) return false ; return true ; }