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

Difficulty: interview

Starter code:

Solutions:
arr = list(input())
n = len(arr)
ans = list()
#for i in arr:
    #ans.append(ord(i)-96)
li = ['b','d','f','h','j','l','n','p','r','t','v','x','z']
s = set(arr)
temp = s.intersection(li)
for _ in range(int(input())):
    x,y = list(map(int,input().split()))
    li = list(temp)
    #s = set()
    c=0
    for i in range(x-1,y):
        if arr[i] in li:
            c+=1 
            li.remove(arr[i])
        if len(li)==0:
            break
    print(c)


S=input()
N=len(S)
Q=int(input())
A=[[0]*27 for i in range(N)]
for i in range(N):
    try:
        if i>0:
            for j in range(1,27):
                A[i][j]=A[i-1][j]
        A[i][ord(S[i])-ord('a')+1]+=1
    except:
        pass
# for i in A:
#     print(i)
while Q>0:
    Q-=1
    X,Y = [int(x) for x in input().split()]
    ans=0
    X-=1
    Y-=1
    for i in range(2,27,2):
        try:
            if X>0:
                val = A[Y][i]-A[X-1][i]
            else:
                val = A[Y][i]
        except:
            pass
        if (val)>0:
            ans+=1
    print(ans)


string = input()
token = {}
for i in range(98,123,2):
    token[chr(i)] = 0
l = [token.copy()]
for letter in string:
    if (ord(letter)+1)%2:
            token[letter] += 1
    l.append(token.copy())
q = int(input())
for query in range(q):
    a,b = map(int,input().split())
    if a > b:
        a,b = b,a
    ans = 0
    if a > len(string):
        a = len(string)
    if b > len(string):
        b = len(string)
    if a < 1:
        a = 1
    if b < 1:
        b = 1
    for i in range(98,123,2):
        if l[b][chr(i)] > l[a-1][chr(i)]:
            ans += 1
    print(ans)  

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353
# from sys import stdin
# input = stdin.readline
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
try:
    # sys.setrecursionlimit(int(pow(10,7)))
    sys.stdin = open("input.txt", "r")
    # sys.stdout = open("../output.txt", "w")
except:
    pass
def pmat(A):
    for ele in A:
        print(*ele,end="\n")
def seive():
    prime=[1 for i in range(10**6+1)]
    prime[0]=0
    prime[1]=0
    for i in range(10**6+1):
        if(prime[i]):
            for j in range(2*i,10**6+1,i):
                prime[j]=0
    return prime

import sys

s = list(sys.stdin.readline().strip())
n = len(s)
BIT = [[0]*(n+1) for i in range(26)]

def update(i, idx, val):
    idx += 1
    while idx <= n:
        BIT[i][idx] += val
        idx += (-idx & idx)

def read(i, idx):
    ret = 0
    while idx > 0:
        ret += BIT[i][idx]
        idx -= (-idx & idx)
    return ret 

for i in range(n):
    update(ord(s[i])-97, i, 1)

q = int(sys.stdin.readline())

for _ in range(q):
    a, b = sys.stdin.readline().split()
    t=2
    if t=="1":
        idx = int(a) - 1
        bit_idx = ord(s[idx])-97
        update(bit_idx, idx, -1)
        s[idx] = b
        bit_idx = ord(b)-97
        update(bit_idx, idx, 1)
    else:
        ans = 0
        l, r = int(a), int(b)
        for i in range(1,26,2):
            ans += 1 if (read(i, r) - read(i, l-1)) > 0 else 0
        print(ans)











endtime = time.time()
# print(f"Runtime of the program is {endtime - starttime}")



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