func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 5;   const long long mod = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     string str;     cin >> str;     long long n = str.length();     vector<pair<long long, long long> > arr;     arr.push_back(make_pair(1, str[0] -  a ));     for (long long i = 1; i < n; i++) {       if (str[i] == str[i - 1])         arr[arr.size() - 1].first++;       else         arr.push_back(make_pair(1, str[i] -  a ));     }     long long ans = 0;     while (arr.size() > 1) {       ans++;       vector<pair<long long, long long> > tmp;       for (long long i = 0; i < arr.size(); i++) {         if (i == 0 || i == arr.size() - 1)           arr[i].first -= 1;         else           arr[i].first -= 2;         if (tmp.size() == 0 || arr[i].second != tmp[tmp.size() - 1].second) {           if (arr[i].first > 0) tmp.push_back(arr[i]);         } else if (arr[i].first > 0)           tmp[tmp.size() - 1].first += arr[i].first;       }       arr = tmp;     }     cout << ans;   }   