2947. Count Beautiful Substrings I
You are given a string
sand a positive integerk.Let
vowelsandconsonantsbe the number of vowels and consonants in a string.A string is beautiful if:
vowels == consonants.(vowels * consonants) % k == 0, in other terms the multiplication ofvowelsandconsonantsis divisible byk.Return the number of non-empty beautiful substrings in the given string
s.A substring is a contiguous sequence of characters in a string.
Vowel letters in English are
'a','e','i','o', and'u'.Consonant letters in English are every letter except vowels.
1 | class Solution { |