Applying sliding window to get all substrings of length K
for i in range ( k - 1 , len ( s ) ) : NEW_LINE INDENT cnt [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1 NEW_LINE flag1 = 0 NEW_LINE for j in range ( 26 ) : NEW_LINE INDENT if ( vowel ( j ) == False and cnt [ j ] > 0 ) : NEW_LINE INDENT flag1 = 1 NEW_LINE break NEW_LINE DEDENT DEDENT if ( flag1 == 0 ) : NEW_LINE INDENT return True NEW_LINE DEDENT DEDENT