#include <bits/stdc++.h>   using namespace std;   char a[55];   int main() {     int n, i, j, k, ans, x;     int len;     while (cin >> a) {       ans = 0;       x = 0;       len = strlen(a);       for (i = 0; i < len; i++) {         for (j = len - 1; j > i; j--) {           for (k = i; k <= j; k++) {             if (a[k] != a[j - k + i]) break;           }           if (k != j + 1) {             ans = max(ans, j - i);           }         }       }       if (ans != 0)         cout << ans + 1 << endl;       else         cout <<  0  << endl;     }     return 0;   }   