#include <iostream>
#include <vector>
using namespace std;
/**
* dp[j][i]表示从j到i的子串是否是回文子串
*/
int maxduichenLen(string str) {
int n = str.size();
vector<vector<bool>> dp(n, vector<bool>(n, false));
int max = 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j <= i; ++j) {
if (i == j) dp[j][i] = true;
else if (i - j == 1) dp[j][i] = str[i] == str[j];
else dp[j][i] = (str[i] == str[j] && dp[j + 1][i - 1]);
if (dp[j][i] && i - j + 1 > max) max = i - j + 1;
}
}
return max;
}
int main() {
string str;
while (cin >> str) {
cout << maxduichenLen(str) << endl;
}
return 0;
}