InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Vowel and Consonant Substrings!

Problem Description

Given a string A consisting of lowercase characters.

You have to find the number of substrings in A which starts with vowel and end with consonants or vice-versa.

Return the count of substring modulo 109 + 7.



Problem Constraints

1 <= |A| <= 105

A consists only of lower-case characters.



Input Format

First argument is an string A.



Output Format

Return a integer denoting the the number of substrings in A which starts with vowel and end with consonants or vice-versa with modulo 109 + 7.



Example Input

Input 1:

 A = "aba"

Input 2:

 A = "a"



Example Output

Output 1:

 2

Output 2:

 0



Example Explanation

Explanation 1:

 Substrings of S are : [a, ab, aba, b, ba, a]Out of these only 'ab' and 'ba' satisfy the condition for special Substring. So the answer is 2.

Explanation 2:

 No possible substring that start with vowel and end with consonant or vice-versa.



NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Vowel and Consonant Substrings! on Interview Code Editor
Sign Up
to access hints and editorial solutions for Vowel and Consonant Substrings!

Discussion


Loading...
Click here to start solving coding interview questions