 # Simple approach and Explanation!

#1

Example: “aba”
approach: Take the count of both vowel and consonants using a for loop.
now iterate over each char of string, whenever you find a vowel, the number of substrings that can be formed is equal to the number of consonants.so add count of consonants to answer. similarly, when you get consonants add the count of vowels to the answer.
explanation:
In “aba”, count of vowel=2, count of consonants=1,answer=0;
for iteration i=0, we found ‘a’, which is a vowel so we need consonant to make substring. here there is only one consonant so we will add 1 to the answer. and decrease the count of vowel by 1 as it is used.
count of vowel=1,count of consonants=1, answer=1;
for iteration i=1, we found ‘b’, which is consonant so add count of vowel to the answer. and decrease the count of consonants by 1;
count of vowel=1, count of consonants=0,answer=2;
for the last iteration, we will again get vowel but the answer remains the same as the count of consonants is 0,