Can you count?
Practice
3.6 (22 votes)
Algorithms
Easy
Hiring
String manipulation
Problem
54% Success 11248 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given a string s consisting of lowercase English letters and/or '_' (underscore).
You have to replace all underscores (if any) with vowels present in the string.

The rule you follow is:
Each underscore can be replaced with any one of the vowel(s) that came before it.

You have to tell the total number of distinct strings we can generate following the above rule.

Input format:
The first line consists of an integer t, denoting the number of test cases.
Each of the next t lines consists of a string s.

Output format:
For each test case, output total number of distinct strings we can generate following the given rule.
Answer for each test case should come in a new line.

Input Constraints:
\(1 \le t \le 4000\)
\(1 \le |s| \le 10^5\); s denotes string length.
Sum of s over all test-cases won't exceed \(10^5.\)
It is guaranteed that there will be atleast one vowel before any '_' (underscore) character in the string.

Note:
It is guaranteed that answer won't go beyond \(5 * 10^{18}\).

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
118 votes
Tags:
EasyHash MapsHashing algorithmString Manipulation
Points:20
26 votes
Tags:
ApprovedBasic ProgrammingEasyImplementationOpenSorting
Points:20
10 votes
Tags:
AlgorithmsEasyImplementationPriority queueString Manipulation