For string $$$s$$$ of lowercase Latin letters, we start with an empty string $$$t$$$ and perform the following operation for each character $$$c$$$ of $$$s$$$ in left-to-right order:
The string $$$s$$$ is considered good if the corresponding string $$$t$$$ is empty after the above sequence of operations. Given a string $$$s$$$ count the number of good substrings of $$$s$$$.
The first line of the input contains $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of a single string $$$s$$$ ($$$1 \le |s| \le 2 \cdot 10^6$$$).
It is guaranteed that the sum of $$$|s|$$$ over all test cases doesn't exceed $$$2 \cdot 10^6$$$.
For each test case, print a single integer — the number of good substrings of $$$s$$$.
5abbcbabbaappqpqqpqpzzzhelloosijekrreeerer
8 4 2 3 4
| Name |
|---|


