#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int Max = 1e5 + 1;
int t[4 * Max];
long long pown(long long i, long long n) {
  if (i % n == 0) return (i / n);
  return (i / n) + 1;
}
long long isPrime(long long n) {
  if (n <= 1) return 1;
  if (n <= 3) {
    if (n == 2)
      return 2;
    else
      return 3;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    if (n % 2 == 0)
      return 2;
    else
      return 3;
  }
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) {
      if (n % i == 0)
        return i;
      else
        return i + 2;
    }
  return n;
}
long long isPower(long long n) {
  if (n <= 1) return false;
  if (n <= 3) {
    return n;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    if (ceil(log2(n)) == floor(log2(n))) {
      return 2;
    } else if (ceil(log2(n) / log2(3)) == floor(log2(n) / log2(3))) {
      return 3;
    } else {
      return 0;
    }
  }
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) {
      if (n % i == 0 && ceil(log(n) / log(i)) == floor(log(n) / log(i))) {
        return i;
      }
      if (n % (i + 2) == 0 &&
          ceil(log(n) / log(i + 2)) == floor(log(n) / log(i + 2))) {
        return i + 2;
      }
    }
  return n;
}
long long greatest_power(long long p, long long n) {
  long long u = ceil(log(n) / log(p));
  long long sum = 0;
  long long f = p;
  for (int i = 1; i <= u + 1; i++) {
    sum += (n / f);
    f = f * p;
  }
  return sum;
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  } else if (b == 0) {
    return a;
  } else if (a > b) {
    return gcd(b, a % b);
  } else {
    return gcd(a, b % a);
  }
}
long long modinv(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res = ((res % mod) * (a % mod)) % mod;
      res = res % mod;
    }
    a = ((a % mod) * (a % mod)) % mod;
    b >>= 1;
  }
  return res;
}
void build(int v, int tl, int tr, string s) {
  if (tl == tr) {
    int u = (int)(s[tl - 1] - 96);
    u--;
    t[v] = t[v] | (1 << u);
  } else {
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm, s);
    build(2 * v + 1, tm + 1, tr, s);
    t[v] = t[2 * v] | t[2 * v + 1];
  }
}
void update(int v, int tl, int tr, char s[], int pos, char c) {
  if (tl == tr) {
    long long u = (int)(s[tl - 1] - 96);
    u--;
    long long w = (int)(c - 96);
    w--;
    t[v] = t[v] & (~(1 << u));
    t[v] = t[v] | (1 << w);
    s[tl - 1] = c;
  } else {
    int tm = (tl + tr) / 2;
    if (pos <= tm) {
      update(2 * v, tl, tm, s, pos, c);
    } else {
      update(2 * v + 1, tm + 1, tr, s, pos, c);
    }
    t[v] = t[2 * v] | t[2 * v + 1];
  }
}
long long sum(int v, int tl, int tr, int l, int r) {
  if (l > r) {
    return 0;
  } else if (tl == l & tr == r) {
    return t[v];
  } else {
    int tm = (tl + tr) / 2;
    return sum(2 * v, tl, tm, l, min(r, tm)) |
           sum(2 * v + 1, tm + 1, tr, max(l, tm + 1), r);
  }
}
void solve() {
  string s;
  cin >> s;
  long long q;
  cin >> q;
  long long n = s.length();
  int u, v;
  char w;
  int w1;
  build(1, 1, n, s);
  char ch[n];
  for (int i = 0; i < n; i++) {
    ch[i] = s[i];
  }
  while (q--) {
    cin >> u;
    if (u == 1) {
      cin >> v >> w;
      update(1, 1, n, ch, v, w);
    } else {
      cin >> v >> w1;
      long long s = sum(1, 1, n, v, w1);
      long long count = 0;
      while (s > 0) {
        if (s % 2 == 1) {
          count++;
        }
        s = s / 2;
      }
      cout << count << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}

### Prompt

In CPP, your task is to solve the following problem:

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;
const long long mod = 998244353;
const int Max = 1e5 + 1;
int t[4 * Max];
long long pown(long long i, long long n) {
  if (i % n == 0) return (i / n);
  return (i / n) + 1;
}
long long isPrime(long long n) {
  if (n <= 1) return 1;
  if (n <= 3) {
    if (n == 2)
      return 2;
    else
      return 3;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    if (n % 2 == 0)
      return 2;
    else
      return 3;
  }
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) {
      if (n % i == 0)
        return i;
      else
        return i + 2;
    }
  return n;
}
long long isPower(long long n) {
  if (n <= 1) return false;
  if (n <= 3) {
    return n;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    if (ceil(log2(n)) == floor(log2(n))) {
      return 2;
    } else if (ceil(log2(n) / log2(3)) == floor(log2(n) / log2(3))) {
      return 3;
    } else {
      return 0;
    }
  }
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) {
      if (n % i == 0 && ceil(log(n) / log(i)) == floor(log(n) / log(i))) {
        return i;
      }
      if (n % (i + 2) == 0 &&
          ceil(log(n) / log(i + 2)) == floor(log(n) / log(i + 2))) {
        return i + 2;
      }
    }
  return n;
}
long long greatest_power(long long p, long long n) {
  long long u = ceil(log(n) / log(p));
  long long sum = 0;
  long long f = p;
  for (int i = 1; i <= u + 1; i++) {
    sum += (n / f);
    f = f * p;
  }
  return sum;
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  } else if (b == 0) {
    return a;
  } else if (a > b) {
    return gcd(b, a % b);
  } else {
    return gcd(a, b % a);
  }
}
long long modinv(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res = ((res % mod) * (a % mod)) % mod;
      res = res % mod;
    }
    a = ((a % mod) * (a % mod)) % mod;
    b >>= 1;
  }
  return res;
}
void build(int v, int tl, int tr, string s) {
  if (tl == tr) {
    int u = (int)(s[tl - 1] - 96);
    u--;
    t[v] = t[v] | (1 << u);
  } else {
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm, s);
    build(2 * v + 1, tm + 1, tr, s);
    t[v] = t[2 * v] | t[2 * v + 1];
  }
}
void update(int v, int tl, int tr, char s[], int pos, char c) {
  if (tl == tr) {
    long long u = (int)(s[tl - 1] - 96);
    u--;
    long long w = (int)(c - 96);
    w--;
    t[v] = t[v] & (~(1 << u));
    t[v] = t[v] | (1 << w);
    s[tl - 1] = c;
  } else {
    int tm = (tl + tr) / 2;
    if (pos <= tm) {
      update(2 * v, tl, tm, s, pos, c);
    } else {
      update(2 * v + 1, tm + 1, tr, s, pos, c);
    }
    t[v] = t[2 * v] | t[2 * v + 1];
  }
}
long long sum(int v, int tl, int tr, int l, int r) {
  if (l > r) {
    return 0;
  } else if (tl == l & tr == r) {
    return t[v];
  } else {
    int tm = (tl + tr) / 2;
    return sum(2 * v, tl, tm, l, min(r, tm)) |
           sum(2 * v + 1, tm + 1, tr, max(l, tm + 1), r);
  }
}
void solve() {
  string s;
  cin >> s;
  long long q;
  cin >> q;
  long long n = s.length();
  int u, v;
  char w;
  int w1;
  build(1, 1, n, s);
  char ch[n];
  for (int i = 0; i < n; i++) {
    ch[i] = s[i];
  }
  while (q--) {
    cin >> u;
    if (u == 1) {
      cin >> v >> w;
      update(1, 1, n, ch, v, w);
    } else {
      cin >> v >> w1;
      long long s = sum(1, 1, n, v, w1);
      long long count = 0;
      while (s > 0) {
        if (s % 2 == 1) {
          count++;
        }
        s = s / 2;
      }
      cout << count << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}

```