#include <bits/stdc++.h>
using namespace std;
bool antiPalindrome = true;
string palindrome;
void readPalindrome() { getline(cin, palindrome); }
bool isPalindrome() {
  int frontInd = 0;
  int backInd = palindrome.size() - 1;
  while (frontInd < backInd) {
    if (palindrome[frontInd] == palindrome[backInd]) {
      frontInd++;
      backInd--;
    } else
      return false;
  }
  return true;
}
int main() {
  readPalindrome();
  antiPalindrome = isPalindrome();
  while (antiPalindrome && palindrome.size() > 0) {
    antiPalindrome = isPalindrome();
    if (antiPalindrome == true)
      palindrome = palindrome.substr(0, palindrome.size() - 1);
  }
  printf("%d\n", palindrome.size());
  return 0;
}
