Applying sliding window to get all substrings of length K
for ( int i = k - 1 ; i < s . size ( ) ; i ++ ) { cnt [ s [ i ] - ' a ' ] ++ ; int flag1 = 0 ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( vowel ( j ) == false && cnt [ j ] > 0 ) { flag1 = 1 ; break ; } } if ( flag1 == 0 ) return true ;