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 [ ord ( x [ i ] ) - 97 ] > 0 ) : NEW_LINE INDENT c += 1 NEW_LINE fr [ ord ( x [ i ] ) - 97 ] -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT print ( c ) NEW_LINE