#P6710. Baltic Strings
Baltic Strings
Baltic Strings
We define a Baltic string as a string consisting entirely of lowercase letters that satisfies all of the following conditions:
- It contains at most \( V_C \) consecutive vowels.
- It contains at most \( C_C \) consecutive consonants.
- It contains at most \( V_E \) consecutive identical vowels.
- It contains at most \( C_E \) consecutive identical consonants.
Here, the vowels are a, e, i, o, u
and the remaining 21 lowercase letters are taken as consonants.
You are given a string in which some characters are lowercase letters and some characters are '*' (asterisks). You can replace each '*' with any lowercase letter. Count the number of different resulting strings that are valid Baltic strings. Since the answer can be very large, output it modulo \(10^9+7\).
inputFormat
The first line contains four integers \( V_C, C_C, V_E, C_E \) separated by spaces. The following line contains a non-empty string consisting of lowercase letters and '*' characters.
outputFormat
Output a single integer representing the number of different Baltic strings that can be obtained by replacing every '*' with a lowercase letter, modulo \(10^9+7\).
sample
2 3 2 2
*
26
</p>