func_code_string: #include <bits/stdc++.h>   using namespace std;   list<char> lanc;   using It = list<char>::iterator;   bool torolni_kell(It mit) {     if (*mit ==  - ) return false;     char akt = *mit, el = *prev(mit), kov = *next(mit);     return (el !=  -  && el != akt) || (kov !=  -  && kov != akt);   }   int main() {     ios_base::sync_with_stdio(false);     string be;     cin >> be;     be =  -  + be +  - ;     lanc.insert(begin(lanc), begin(be), end(be));     int valasz = 0;     vector<It> to_check;     for (It it = next(lanc.begin()); *it !=  - ; ++it) to_check.push_back(it);     while (1) {       vector<It> torlendok;       for (It akt : to_check)         if (torolni_kell(akt)) torlendok.push_back(akt);       to_check = {};       for (int i = 0; i < torlendok.size(); i++) {         if ((i == 0 || prev(torlendok[i]) != torlendok[i - 1]) &&             (to_check.empty() || to_check.back() != prev(torlendok[i])))           to_check.push_back(prev(torlendok[i]));         if ((i + 1 == torlendok.size() ||              next(torlendok[i]) != torlendok[i + 1]) &&             (to_check.empty() || to_check.back() != next(torlendok[i])))           to_check.push_back(next(torlendok[i]));       }       if (torlendok.empty()) break;       for (auto akt : torlendok) lanc.erase(akt);       valasz++;     }     cout << valasz;   }   