Chef got Recipes

All submissions for this problem are available.
### Read problem statements in [Hindi](http://www.codechef.com/download/translated/MAR19TST/hindi/JAIN.pdf), [Bengali](http://www.codechef.com/download/translated/MAR19TST/bengali/JAIN.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/MAR19TST/mandarin/JAIN.pdf), [Russian](http://www.codechef.com/download/translated/MAR19TST/russian/JAIN.pdf), and [Vietnamese](http://www.codechef.com/download/translated/MAR19TST/vietnamese/JAIN.pdf) 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 \le T \le 1,000$  $1 \le N \le 10^5$  $1 \le D_i \le 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 \le T \le 100$  $1 \le N \le 100$  the sum of all D_i over all test cases does not exceed $20000$ **Subtask #2 (80 points):** original constraints ### Example Input ``` 1 3 aaooaoaooa uiieieiieieuuu aeioooeeiiaiei ``` ### Example Output ``` 2 ``` ### Explanation **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.Author:  iamabjain 
Editorial  https://discuss.codechef.com/problems/JAIN 
Tags  bitmasking, iamabjain, march19, maths, simple, taran_1407 
Date Added:  19052017 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 