Dhruvil has always been a studious person and will be completing his Engineering soon. He is always kneen about solving problems and is preparing hard for his next interview at Hackerrank. He has practiced lots of problems and now he came across this problem.
Given a message containing English letters(A-Z), it is being encoded to numbers using the following mapping:
'A' -> 1,'B' -> 2 ……………… 'Z' -> 26.
Now, given a non-empty string containing only digits, help Dhruvil determine the total number of ways to decode it.
While decoding you need to choose a substring of charachters and not a subsequence. Also a chosen substring should not contain any leading "0"s, but can contain trailing "0"s. Since the output can be very large print the answer as modulo 10^9 + 7 i.e 1000000007.

-----Input:-----
The first line of the input consists of single integer T, the number of test cases.
Each test case consists of a string.

-----Output:-----
For each test case print a single integer - the total number of ways to decode the digit string.

-----Constraints-----
- $1 \leq T \leq 1000$
- $2 \leq S \leq 10^9$

-----Sample Input:-----
2
12

226

-----Sample Output:-----
2

3

-----EXPLANATION:-----
There are 2 possible ways. It could be decoded as "AB" {1,2} or "L" {12}.
There are 3 possible ways. It could be decoded as "BZ" {2,26}, "VF" {22,6}, or "BBF" {2,2,6}.

```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 = 'import sys\nimport math\nimport bisect\nfrom sys import stdin,stdout\nfrom math import gcd,floor,sqrt,log\nfrom collections import defaultdict as dd\nfrom bisect import bisect_left as bl,bisect_right as br\n\nsys.setrecursionlimit(100000000)\n\nii =lambda: int(input())\nsi =lambda: input()\njn =lambda x,l: x.join(map(str,l))\nsl =lambda: list(map(str,input().strip()))\nmi =lambda: list(map(int,input().split()))\nmif =lambda: list(map(float,input().split()))\nlii =lambda: list(map(int,input().split()))\n\nceil =lambda x: int(x) if(x==int(x)) else int(x)+1\nceildiv=lambda x,d: x//d if(x%d==0) else x//d+1\n\nflush =lambda: stdout.flush()\nstdstr =lambda: stdin.readline()\nstdint =lambda: int(stdin.readline())\nstdpr =lambda x: stdout.write(str(x))\n\nmod=1000000007\ndef sol(s):  \n dp = [0] * (len(s) + 2)\n dp[0] = 1\n  \n for i in range(len(s)):\n  if int(s[i]) != 0:\n   dp[i+1] += dp[i]\n   \n  if int(s[i:i+2]) >= 10 and int(s[i:i+2]) <= 26:\n   dp[i+2] += dp[i]\n  \n return dp[len(s)] \n \n\n\n#main code\nfor _ in range(ii()):\n s=si()\n ans=sol(s)\n print(ans%mod)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15927