A machine has $$$M$$$ slots numbered from $$$1$$$ to $$$M$$$, where cards with letters can be placed. Each slot $$$i$$$ can only be filled with cards from a specific set of available cards for that slot. When all $$$M$$$ slots are filled, the letters in the cards form a word by concatenating the letters from left to right across the slots.
Each card can only be used once to create words.
A word is considered beautiful if and only if all of its characters are distinct. For example, the words abchd, a, and ab are beautiful, while the words abdsa and aa are not.
The task is to determine the maximum number of distinct beautiful words that can be created using the available cards for each slot.

Figure 1. The first test from the sample.
The first line contains one integer $$$T$$$ ($$$1 \leq T \leq 10^3$$$), the number of test cases. Then, for each test case:
The total sum of $$$|S_i|$$$ across all test cases does not exceed $$$10^6$$$.
For each test:
24aaababcdccdade3aaabcabbbcabccc
3 bcda adce abcd 5 abc abc abc cab bca
| Name |
|---|


