func_code_string: #include <bits/stdc++.h>   using namespace std;   const int IN = 2e5 + 7;   int sum[IN];   int main() {     string str;     cin >> str;     int n;     scanf( %d , &n);     memset(sum, 0, sizeof(sum));     if (str[0] == str[1])       sum[0] = 1;     else       sum[0] = 0;     int k = str.size();     for (int i = 1; i < k - 1; i++) {       if (str[i] == str[i + 1]) {         sum[i] = sum[i - 1] + 1;       } else {         sum[i] = sum[i - 1];       }     }     sum[k - 1] = sum[k - 2];     int l, r;     for (int i = 0; i < n; i++) {       scanf( %d%d , &l, &r);       if (l != 1)         printf( %d n , sum[r - 2] - sum[l - 2]);       else         printf( %d n , sum[r - 2]);     }   }   