P17439 [CodeChef] JAIN
提高-
题目描述

Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.

A meal consists of exactly two dishes. Preparing a meal from dishes $i$ and $j$ ($i \neq j$) means concatenating the strings $D_{i}$ and $D_{j}$ in an arbitrary order into a string $M$ describing the meal. Chef likes this meal if the string $M$ contains each lowercase vowel at least once.

Now, Chef is wondering - what is the total number of (unordered) pairs of dishes such that he likes the meal prepared from these dishes?

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
$N$ lines follow. For each valid $i$, the $i$-th of these lines contains a single string $D_{i}$.

------ Output ------
For each test case, print a single line containing one integer - the number of ways to prepare a meal Chef likes.

------ Constraints ------
$1 ≤ T ≤ 1,000$
$1 ≤ N ≤ 10^{5}$
$1 ≤ |D_{i}| ≤ 1,000$ for each valid $i$
the sum of all |D_{i}| over all test cases does not exceed $3 \cdot 10^{7}$

------ Subtasks ------
Subtask #1 (20 points):
$1 ≤ T ≤ 100$
$1 ≤ N ≤ 100$
the sum of all |D_{i}| over all test cases does not exceed $20000$

Subtask #2 (80 points): original constraints

----- Sample Input 1 ------
1

3

aaooaoaooa

uiieieiieieuuu

aeioooeeiiaiei
----- Sample Output 1 ------
2
----- explanation 1 ------
Example case 1: There are three possible meals:
- A meal prepared from dishes $1$ and $2$ (for example "aaooaoaooauiieieiieieuuu") contains all vowels.
- A meal prepared from dishes $1$ and $3$ (for example "aaooaoaooaaeioooeeiiaiei") does not contain 'u'.
- A meal prepared from dishes $2$ and $3$ (for example "uiieieiieieuuuaeioooeeiiaiei") contains all vowels.

输入格式

见题面

输出格式

见题面

样例输入
1 3 aaooaoaooa uiieieiieieuuu aeioooeeiiaiei
样例输出
2