Function to check if the string s consists of a single distinct character or not
static boolean isUnique ( String s ) { HashSet < Character > set = new HashSet < > ( ) ; for ( char c : s . toCharArray ( ) ) set . add ( c ) ; return set . size ( ) == 1 ; }