checking if the frequency of the character at position i in x in b is greater than zero or not if zero we increase the prefix count by 1
if ( fr [ x . charAt ( i ) - 97 ] > 0 ) { c += 1 ; fr [ x . charAt ( i ) - 97 ] -= 1 ; } else break ; } System . out . println ( ( c ) ) ; }