Condition for valid substring
if ( count [ 0 ] > 0 and count [ 1 ] > 0 and count [ 2 ] > 0 and count [ 3 ] > 0 and count [ 4 ] > 0 ) : NEW_LINE INDENT ans = min ( ans , x - start + 1 ) NEW_LINE DEDENT if ( ans == n + 1 ) : NEW_LINE return - 1 NEW_LINE return ans NEW_LINE