- Given A String Of Lowercase Letters In The Range Ascii A Z Determine The Number Of Substrings That Can Be Created 1 (54.21 KiB) Viewed 76 times
Given a string of lowercase letters in the range ascii['a'-'z'], determine the number of substrings that can be created
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Given a string of lowercase letters in the range ascii['a'-'z'], determine the number of substrings that can be created
Given a string of lowercase letters in the range ascii['a'-'z'], determine the number of substrings that can be created where every letter is a vowel and every vowel is present at least once. The vowels are ['a', 'e', '1', 'o', 'u]. A substring is a contiguous group of characters in the string. Example s='aeioaexaaeuiou" There is a substring to the left that is made of vowels, 'aeloae'which is followed by an 'x'. Since 'x' is not a vowel, it cannot be included in the substring, and this substring does not contain all of the vowels. It is not a qualifying substring. Moving to the right, there are four substrings that do qualify: 'aaeuiou', 'aaeuid', 'aeuiou' and 'aeuio'. Function Description Complete the function vowelSubstring in the editor below. vowelSubstring has the following parameter(s): string s: a string Returns int: the number of substrings which consist of vowels only ('a', 'e,' ', 'o', 'u') where every vowel appears at least once Constraints 1s size_of(s) s 105 s e ascii['a'-'z] (where 0 si <size_of(s)) Test n