The notorious hacker group "Sed" managed to obtain a string $S$ from their secret sources. The string contains only lowercase English letters along with the character '?'.
A substring of $S$ is a contiguous subsequence of that string. For example, the string "chef" is a substring of the string "codechef", but the string "codeh" is not a substring of "codechef".
A substring of $S$ is good if it is possible to choose a lowercase English letter $C$ such that the following process succeeds:
- Create a string $R$, which is a copy of the substring, but with each '?' replaced by the letter $c$. Note that all occurrences of '?' must be replaced by the same letter.
- For each lowercase English letter:
- Compute the number of times it occurs in $S$ and the number of times it occurs in $R$; let's denote them by $A$ and $B$ respectively. The '?' characters in the original string $S$ are ignored when computing $A$.
- Check the parity of $A$ and $B$. If they do not have the same parity, i.e. one of them is even while the other is odd, then this process fails.
- If the parities of the number of occurrences in $S$ and $R$ are the same for each letter, the process succeeds.
For different substrings, we may choose different values of $C$.
Help Sed find the number of good substrings in the string $S$.

-----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 and only line of each test case contains a single string $S$.

-----Output-----
For each test case, print a single line containing one integer ― the number of good substrings.

-----Constraints-----
- $1 \le T \le 10^5$
- $1 \le S \le 10^5$
- $S$ contains only lowercase English letters ('a' through 'z') and '?'
- the sum of $|S|$ over all test cases does not exceed $10^5$

-----Example Input-----
5
aa?
a???
????
asfhaslskfak
af??avvnfed?fav?faf????

-----Example Output-----
2
6
4
2
27

-----Explanation-----
Example case 1: All letters occur an even number of times in $S$. The six substrings of $S$ are "a", "a", "?", "aa", "a?" and "aa?" (note that "a" is counted twice). Which of them are good?
- "a" is not good as 'a' occurs an odd number of times in this substring and there are no '?' to replace.
- "?" is also not good as replacing '?' by any letter causes this letter to occur in $R$ an odd number of times.
- "aa" is a good substring because each letter occurs in it an even number of times and there are no '?' to replace.
- "a?" is also a good substring. We can replace '?' with 'a'. Then, $R$ is "aa" and each letter occurs in this string an even number of times. Note that replacing '?' e.g. with 'b' would not work ($R$ would be "ab", where both 'a' and 'b' occur an odd number of times), but we may choose the replacement letter $C$ appropriately.
- "aa?" is not a good substring. For any replacement letter $C$, we find that $C$ occurs an odd number of times in $R$.
Example case 2: We especially note that "a???" is not a good substring. Since all '?' have to be replaced by the same character, we can only get strings of the form "aaaa", "abbb", "accc", etc., but none of them match the criteria for a good substring.
Example case 3: Any substring with even length is good.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '"""\r\nCode Chef :: December 2020 Cookoff :: Sed Passwords \r\nProblem Code: SEDPASS\r\nhttps://www.codechef.com/COOK125A/problems/SEDPASS\r\n"""\r\nimport sys\r\n\r\n\r\ndef solve(S):\r\n    """Solve puzzle."""\r\n    N = len(S)\r\n    parity_S = 0\r\n    qs_add = (1 << 26)\r\n    ord_a = ord(\'a\')\r\n    for i, c in enumerate(S):\r\n        if c != \'?\':\r\n            parity_S ^= (1 << (ord(c) - ord_a))\r\n\r\n    # The 27 good bitsets.\r\n    # The first is even parity ?s (26th bit = 0) and parity_S\r\n    good_Rs = [parity_S]\r\n    for c in range(26):\r\n        # The rest are odd parity ?s (26th bit) and parity_S with one\r\n        # character, c, with the opposite parity.\r\n        good_Rs.append((parity_S ^ (1 << c)) | qs_add)\r\n\r\n    # A substring S[i:j] has a parity of S[:j] ^ S[:i].\r\n    # a ^ b = c implies a ^ c = b.\r\n    # If S[:j] ^ a good_Rs = some S[:i] then S[i:j] is a good substring.\r\n    # So if we keep track of the S[:i] that we have already seen and \r\n    # at each j check each good_Rs to see if it matches previous S[:j]s\r\n    # that we have cached.  Note: a subtring parity may occur more than once.\r\n    prefix_parities = dict()\r\n    prefix_parities[0] = 1  # Be sure to add an empty S[:i].\r\n\r\n    parity_R = 0\r\n    soln = 0\r\n    for j, c in enumerate(S):\r\n        if c == "?":\r\n            parity_R ^= qs_add\r\n        else:\r\n            parity_R ^= (1 << (ord(c) - ord_a))\r\n\r\n        for good_R in good_Rs:\r\n            soln += prefix_parities.get(good_R ^ parity_R, 0)\r\n        if parity_R in prefix_parities:\r\n            prefix_parities[parity_R] += 1\r\n        else:\r\n            prefix_parities[parity_R] = 1\r\n\r\n    return soln\r\n\r\n\r\ndef main():\r\n    """Main program."""\r\n    test_cases = int(sys.stdin.readline())\r\n    for _ in range(test_cases):\r\n        S = sys.stdin.readline().strip()\r\n        print(solve(S))\r\n\r\n\r\ndef __starting_point():\r\n    main()\r\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13943