There are total $N$ cars in a sequence with $ith$ car being assigned with an alphabet equivalent to the $ith$ alphabet of string $S$ . Chef has been assigned a task to calculate the total number of cars with alphabet having a unique even value in the given range X to Y (both inclusive)
. The value of an alphabet is simply its position in alphabetical order e.g.: a=1, b=2, c=3…
The chef will be given $Q$
such tasks having varying values of $X$ and $Y$
Note: string $S$ contains only lowercase alphabets

-----Input-----
First line of input contains a string $S$ of length $N$.
Second line contains an integer denoting no. of queries $Q$.
Next q lines contain two integers denoting values of $X$ and $Y$.

-----Output-----
For each query print a single integer denoting total number of cars with alphabet having a unique even value in the given range $X$ to $Y$.

-----Constraints-----
- $1 \leq n \leq 10^5$
- $1 \leq q \leq 10^5$

-----Example Input-----
bbccdd
5
1 2
3 4
5 6
1 6
2 5

-----Example Output-----
1
0
1
2
2

-----Explanation:-----
Example case 1: 
Query 1: range 1 to 2 contains the substring $"bb"$ where each character has a value of 2. Since we will only be considering unique even values, the output will be 1

```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\r\ninput = lambda: sys.stdin.readline().rstrip("\\r\\n")\r\ninp = lambda: list(map(int,sys.stdin.readline().rstrip("\\r\\n").split()))\r\n#______________________________________________________________________________________________________\r\n# from math import *\r\n# from bisect import *\r\n# from heapq import *\r\n# from collections import defaultdict as dd\r\n# from collections import OrderedDict as odict\r\n# from collections import Counter as cc\r\n# from collections import deque\r\n# sys.setrecursionlimit(2*(10**5)+100) this is must for dfs\r\n# mod = 10**9+7; md = 998244353\r\n# ______________________________________________________________________________________________________\r\n# Checking prime in O(root(N))\r\n# def isprime(n):\r\n#     if (n % 2 == 0 and n > 2) or n == 1: return 0\r\n#     else:\r\n#         s = int(n**(0.5)) + 1\r\n#         for i in range(3, s, 2):\r\n#             if n % i == 0:\r\n#                 return 0\r\n#         return 1\r\n# def lcm(a,b):\r\n#   return (a*b)//gcd(a,b)\r\n# ______________________________________________________________________________________________________\r\n# nCr under mod\r\n# def C(n,r,mod):\r\n#   if r>n:\r\n#       return 0\r\n#   num = den = 1\r\n#   for i in range(r):\r\n#       num = (num*(n-i))%mod\r\n#       den = (den*(i+1))%mod\r\n#   return (num*pow(den,mod-2,mod))%mod\r\n# M = 10**5 +10\r\n# ______________________________________________________________________________________________________\r\n# For smallest prime factor of a number\r\n# M = 1000010\r\n# pfc = [i for i in range(M)]\r\n# def pfcs(M):\r\n#   for i in range(2,M):\r\n#       if pfc[i]==i:\r\n#           for j in range(i+i,M,i):\r\n#               if pfc[j]==j:\r\n#                   pfc[j] = i\r\n#   return\r\n# pfcs(M)\r\n# ______________________________________________________________________________________________________\r\n# import sys\r\nsys.setrecursionlimit(10**5)\r\n# n = int(sys.stdin.readline().strip())\r\n# a = list(map(int,sys.stdin.readline().strip().split()))\r\na = str(input())\r\nn = len(a)\r\nst = [float(\'inf\') for i in range(4*len(a))]\r\ndef build(a,ind,start,end):\r\n\tif start == end:\r\n\t\tst[ind] = [a[start]] if ord(a[start])%2==0 else []\r\n\telse:\r\n\t\tmid = (start+end)//2\r\n\t\tbuild(a,2*ind+1,start,mid)\r\n\t\tbuild(a,2*ind+2,mid+1,end)\r\n\t\tst[ind] = list(set(st[2*ind+1]+st[2*ind+2]))\r\nbuild(a,0,0,n-1)\r\ndef query(ind,l,r,start,end):\r\n\tif start>r or end<l:\r\n\t\treturn []\r\n\tif l<=start<=end<=r:\r\n\t\treturn st[ind]\r\n\tmid = (start+end)//2\r\n\treturn list(set(query(2*ind+1,l,r,start,mid)+query(2*ind+2,l,r,mid+1,end)))\r\nfor i in range(int(input())):\r\n\tl,r = inp()\r\n\tans = query(0,l-1,r-1,0,n-1)\r\n\t# print(ans)\r\n\tprint(len(ans))\r\n# tc = 1\r\n# # tc, = inp()\r\n# for _ in range(tc):\r\n#     # s = str(input())\r\n#     a = [i for i in input().split()]\r\n#     k = min(a,key = lambda x:len(x))\r\n#     print(k)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13783