#include using namespace std; using Graph = vector>; // グラフ型 Graph G; // グラフ using ll = long long; using ld = long double; using str = string; #define nedl endl #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define repi(i,a,b) for(long long i = long long(a); i> S; ll ss = 0; for (ll i = 0; i < S.length() / 2; i++) { ss = S.length() - 1; if (S[i] == S[ss] - i) { kaibun = true; } } ss = S.length() - 1; ll jj; rep(j, ss) { jj = j + 1; if (S[j] != S[jj]) { onaji = true; } } if (onaji == true) { cout << 0 << endl; } else { if (kaibun == true) { bool kaibun2 = true; ll p, q, r, t; ll l; bool aru = false; bool arukamo = false; for (l = 2; l <= S.length(); l = l + 2) { for (p = 0; p < S.length() - 1; p++) { for (q = p + 1; q < S.length(); q++) { r = 0; arukamo = true; for (t = S.length() - 1; r > t; t--) { if (r == p || r == q) { r++; } if (t == p || t == q) { t--; } if (r > t) { break; } if (S[t] == S[r]) { } else { arukamo = false; } if (arukamo == true) { aru = true; } if (aru == true) { break; } r++; } if (aru == true) { break; } } if (aru == true) { break; } } if (aru == true) { break; } } cout << S.length() - l << endl; } else { cout << S.length() << endl; } } }