Question is not correctly explained


question asked to count all substrings starting from vowel and ending at consonant or vice versa…
So required substrings for “abc” would be [“ab”,“ac”,“abc”],these all are satisfying above statement so count would be 3. But in real ans is taking only two length substrings i.e [“ab”,“ac”]


The substring of a string is a subset of the contiguous characters of the string.
In [“ab”,“ac”,“abc”], “ac” is not a substring of “abc”. So in real it is taking [“ab”,“abc”].


[“ab”,“bc”] not [“ab”,“abc”] are the required substrings…


we can not take “bc” because it doesn’t start with a vowel or end with a vowel. It is starting and ending with a consonant which violates the condition given in the question.


Read the question once more carefully and check the examples of the context. You misunderstood the question.