Mark those characters which are not present in both lowercase and uppercase
Map < Character , Integer > mp = new HashMap < Character , Integer > ( ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( small [ i ] != 0 && caps [ i ] == 0 ) mp . put ( ( char ) ( i + ' a ' ) , 1 ) ; else if ( caps [ i ] != 0 && small [ i ] == 0 ) mp . put ( ( char ) ( i + ' A ' ) , 1 ) ; }