Problem: You are given a string consisting of lowercase Latin characters. Count the number of nonempty strings "" such that it is possible to partition into some substrings satisfying the following conditions:
- each substring either equals or "", and
- at least one substring equals .
A partition of a string is an ordered sequence of some strings (called substrings) such that , where represents the concatenation operation.
Input Format: The first line contains a single integer () — the number of test cases.
The only line of each test case contains a string consisting of lowercase Latin characters ().
The sum of over all test cases does not exceed .
Output Format: For each test case, output a single integer — the number of nonempty strings "" that satisfy all constraints.
Note: In the first test case, can be "", "", "", or the full string.
In the second test case, can be "", "", "", or the full string.
In the third test case, the only such is the full string.