Under construction

Still being built. Things may change

Honggik University

Interview

Time limit1sMemory limit1024 MB

Summary
Count the ways to split a word into contiguous segments that each contain exactly one vowel, modulo 10^9+7, or print -1 if the word has no vowels.
Level

Easy3 of 10

Topics
String, Math
Solved
No attempts yet

Problem

The English name of Hongik University is hongik university. However, some readers pronounce it as hon/gik instead of hong/ik, which turns it into the unintended name Honggik University (혼긱대학교), and this happens often enough to be funny.

Donghyun noticed that a word's pronunciation changes depending on whether a consonant attaches to the vowel before it or the vowel after it. He wants to find out how many different ways similar English words can be pronounced. Since he is weak at English, he only uses the rules below to work out pronunciations.

  • English has 5 vowels, a, e, i, o, and u. The consonants are the other 21 letters of the alphabet.
  • One vowel can have zero or more consonants attached before and after it to form one sound. The sounds together form the pronunciation of the word.
    • Example: h, o, n, g, i, k → hong, ik → hongik
  • A consonant can join a consonant or a vowel into one sound only when they are adjacent.
  • Sounds with a different number, makeup, or order of letters are treated as different sounds.
    • Example: ab, abb, and ba are all different sounds.
  • Each letter of the given word must be used exactly once to form the pronunciation.
  • If the composition of the sounds differs, the pronunciations of the word are counted as different.

Following these rules, output the number of ways the word can be pronounced.

Input

The first line contains the number of test cases TT. (1≤T≤100 000)(1 \le T \le 100\,000)

Each of the next TT lines contains a word SS made of lowercase English letters. (1≤∣S∣≤300 000)(1 \le |S| \le 300\,000)

The total length of all words is at most 1 000 0001\,000\,000.

Output

For each test case, print the number of ways the word can be pronounced, modulo 109+710^9+7, on its own line.

If the word has no vowels and cannot be pronounced, print -1.

Hint

hongik can be pronounced in 3 ways: ho/ngik, hon/gik, and hong/ik.

Examples1

  1. Example 1

    Input
    3
    hongik
    hicon
    rhythm
    
    Expected output
    3
    2
    -1