#include <bits/stdc++.h>
using namespace std;
vector<long long> val;
long long max(long long a, long long b) {
  if (a >= b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a >= b)
    return b;
  else
    return a;
}
long long checkprime(long long a) {
  int flag = 1;
  for (int i = 2; i <= sqrt(a); i++) {
    if (a % i == 0) {
      flag = 0;
      break;
    }
  }
  return flag;
}
unsigned long long power(unsigned long long x, long long y, long long p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
unsigned long long modInverse(unsigned long long n, long long p) {
  return power(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n, long long r,
                                 long long p) {
  if (n < r) return 0;
  if (r == 0) return 1;
  unsigned long long fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long factorial(long long n, long long p) {
  long long res = 1, i;
  for (i = 2; i <= n; i++) res = (long long)(res * i) % p;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<set<int>> st(26);
  for (int i = 0; i < s.length(); i++) {
    st[s[i] - 'a'].insert(i + 1);
  }
  while (q--) {
    int k;
    cin >> k;
    if (k == 1) {
      int j;
      char c;
      cin >> j >> c;
      st[s[j - 1] - 'a'].erase(j);
      st[c - 'a'].insert(j);
      s[j - 1] = c;
    } else {
      int l, r;
      cin >> l >> r;
      int cnt = 0;
      for (int i = 0; i < 26; i++) {
        set<int>::iterator it;
        it = st[i].lower_bound(l);
        if (it != st[i].end() && *it <= r) {
          cnt++;
        }
      }
      cout << cnt << "\n";
    }
  }
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

You are given a string s consisting of lowercase Latin letters and q queries for this string.

Recall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For example, the substrings of "codeforces" are "code", "force", "f", "for", but not "coder" and "top".

There are two types of queries: 

  * 1~ pos~ c (1 ≤ pos ≤ |s|, c is lowercase Latin letter): replace s_{pos} with c (set s_{pos} := c); 
  * 2~ l~ r (1 ≤ l ≤ r ≤ |s|): calculate the number of distinct characters in the substring s[l; r]. 

Input

The first line of the input contains one string s consisting of no more than 10^5 lowercase Latin letters.

The second line of the input contains one integer q (1 ≤ q ≤ 10^5) — the number of queries.

The next q lines contain queries, one per line. Each query is given in the format described in the problem statement. It is guaranteed that there is at least one query of the second type.

Output

For each query of the second type print the answer for it — the number of distinct characters in the required substring in this query.

Examples

Input


abacaba
5
2 1 4
1 4 b
1 5 b
2 4 6
2 1 7


Output


3
1
2


Input


dfcbbcfeeedbaea
15
1 6 e
1 4 b
2 6 14
1 7 b
1 12 c
2 6 8
2 1 6
1 7 c
1 2 f
1 10 a
2 7 9
1 10 a
1 14 b
1 1 f
2 1 11


Output


5
2
5
2
6

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
vector<long long> val;
long long max(long long a, long long b) {
  if (a >= b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a >= b)
    return b;
  else
    return a;
}
long long checkprime(long long a) {
  int flag = 1;
  for (int i = 2; i <= sqrt(a); i++) {
    if (a % i == 0) {
      flag = 0;
      break;
    }
  }
  return flag;
}
unsigned long long power(unsigned long long x, long long y, long long p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
unsigned long long modInverse(unsigned long long n, long long p) {
  return power(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n, long long r,
                                 long long p) {
  if (n < r) return 0;
  if (r == 0) return 1;
  unsigned long long fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long factorial(long long n, long long p) {
  long long res = 1, i;
  for (i = 2; i <= n; i++) res = (long long)(res * i) % p;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<set<int>> st(26);
  for (int i = 0; i < s.length(); i++) {
    st[s[i] - 'a'].insert(i + 1);
  }
  while (q--) {
    int k;
    cin >> k;
    if (k == 1) {
      int j;
      char c;
      cin >> j >> c;
      st[s[j - 1] - 'a'].erase(j);
      st[c - 'a'].insert(j);
      s[j - 1] = c;
    } else {
      int l, r;
      cin >> l >> r;
      int cnt = 0;
      for (int i = 0; i < 26; i++) {
        set<int>::iterator it;
        it = st[i].lower_bound(l);
        if (it != st[i].end() && *it <= r) {
          cnt++;
        }
      }
      cout << cnt << "\n";
    }
  }
}

```