#include <iostream>
using namespace std;
int main()
{
    string rec;
    int rez = 1;
    cin >> rec;
    int par = rec.size()-1;
    for (int i = 0; i<=rec.size()/2;i++)
    {
        if (rec[i]!=rec[par])
        {
            rez = par-i;
            break;
        }

        par--;
    }
    cout << rez<<endl;

}