题目描述
You came across this story while reading a book. Long a ago when the modern entertainment systems did not exist people used to go to watch plays in theaters, where people would perform live in front of an audience. There was a beautiful actress who had a disability she could not pronounce the character $'r'$. To win her favours which many have been denied in past, you decide to write a whole play without the character $'r'$. Now you have to get the script reviewed by the editor before presenting it to her.
The editor was flattered by the script and agreed to you to proceed. The editor will edit the script in this way to suit her style. For each word replace it with a sub-sequence of itself such that it contains the character 'a'.
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements Wikipedia
Now given a script with $N$ words, for each word in the script you wish to know the number of subsequences with which it can be replaced.
-----Input:-----
- First-line will contain $N$, the number of words in the script. Then next $N$ line with one test case each.
- Each test case contains a single word $W_i$
-----Output:-----
For each test case, output in a single line number of subsequences with which it can be replaced.
-----Constraints-----
- $1 \leq N \leq 1000$
- $1 \leq$ length of $W_i$ $\leq 20$
- $W_i$ on contains lowercase english alphabets and does not have the character 'r'
-----Sample Input 1:-----
2
abc
aba
-----Sample Output 1:-----
4
6
-----EXPLANATION:-----
This subsequences with which $abc$ can be replaed : ${a,ab,ac,abc}$.
This subsequences with which $aba$ can be replaed : ${a,ab,aba,a,ba,a}$.
-----Sample Input 2:-----
3
abcde
abcdea
xyz
-----Sample Output 2:-----
16
48
0
输入格式
见题面
输出格式
见题面