idx [ i ] stores the next available index of char ( ' a ' + i ) in occur [ i ]
int [ ] idx = new int [ 26 ] ; boolean poss = true ; for ( int x = 0 ; x < n ; x ++ ) { char ch = ( char ) ( t . charAt ( x ) - ' a ' ) ;