func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<long long, long long>;   const long long INF = 2e18;   template <class A, class B>   ostream &operator<<(ostream &os, const pair<A, B> &p) {     os <<  (  << p.first <<  ,   << p.second <<  ) ;     return os;   }   template <class A>   ostream &operator<<(ostream &os, const vector<A> &v) {     os <<  { ;     for (long long i = 0; i < (long long)v.size(); i++)       if (i == 0)         os << v[i];       else         os <<  ,   << v[i];     os <<  } ;     return os;   }   void dprint(string s) { cout <<   n ; }   template <class T, class... U>   void dprint(string s, T t, U... u) {     long long w = s.find( , );     cout <<  [  << s.substr(0, w) <<  :   << t <<  ]  ;     dprint(s.substr(w + 2, (long long)s.size() - w - 1), u...);   }   const long long N = 1e6 + 5;   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string s;     cin >> s;     vector<pair<char, long long>> v;     for (long long i = 0; i < (long long)(s).size();) {       char c = s[i];       long long cnt = 0;       while (s[i] == c and i < (long long)(s).size()) cnt++, i++;       v.push_back({c, cnt});     }     if ((long long)(v).size() % 2) {       bool ok = 1;       for (long long i = 0; i < (long long)(v).size() / 2; i++) {         if (v[i].first == v[(long long)(v).size() - 1 - i].first and             v[i].second + v[(long long)(v).size() - 1 - i].second >= 3)           ;         else           ok = 0;       }       if (v[(long long)(v).size() / 2].second == 1) ok = 0;       if (ok)         cout << v[(long long)(v).size() / 2].second + 1;       else         cout << 0;     } else {       cout << 0;     }     return 0;   }   