#include <bits/stdc++.h>   using namespace std;   class IntTree {    public:     IntTree(int size) : nodes_(4 * size + 10, 0), size_(size) {}     void Set(int pos, char ch) { Set(0, 1, size_, pos, ch); }     int Count(int left, int right) {       int mask = Mask(0, 1, size_, left, right);       return CountBits(mask);     }       private:     static int Left(int node) { return 2 * node + 1; }     static int Right(int node) { return 2 * node + 2; }     static int CountBits(int num);     void Set(int node, int left, int right, int pos, char ch);     int Mask(int node, int left, int right, int x, int y);     vector<int> nodes_;     int size_;   };   int IntTree::CountBits(int num) {     int count = 0;     while (num > 0) {       count += 1;       num -= (num & -num);     }     return count;   }   void IntTree::Set(int node, int left, int right, int pos, char ch) {     if (left == right) {       nodes_[node] = (1 << (ch -  a ));       return;     }     int mid = left + (right - left) / 2;     if (pos <= mid) {       Set(Left(node), left, mid, pos, ch);     } else {       Set(Right(node), mid + 1, right, pos, ch);     }     nodes_[node] = (nodes_[Left(node)] | nodes_[Right(node)]);   }   int IntTree::Mask(int node, int left, int right, int x, int y) {     if (x <= left && right <= y) {       return nodes_[node];     }     int mask = 0;     int mid = left + (right - left) / 2;     if (x <= mid) {       mask |= Mask(Left(node), left, mid, x, y);     }     if (mid < y) {       mask |= Mask(Right(node), mid + 1, right, x, y);     }     return mask;   }   int main() {     string str;     getline(cin, str);     IntTree tree(str.size());     for (size_t i = 0; i < str.size(); i += 1) {       tree.Set(i + 1, str[i]);     }     int queries;     cin >> queries;     for (int i = 0; i < queries; i += 1) {       int type, x, y;       char ch;       cin >> type;       if (type == 1) {         cin >> x >> ch;         tree.Set(x, ch);       } else {         cin >> x >> y;         cout << tree.Count(x, y) <<   n ;       }     }     return 0;   }   