#include <iostream>
#include <string>
using namespace std;

int main()
{
    int k=0,h,i=0,o,l;
    string t;
    cin>>t;

    string string1(t);
    string string2;
    string stringOne(t);
    h=stringOne.size();
   // cout << "A stringOne string hossza "<< stringOne.size() << " karacter\n";
   while((string1[i]==string1[h-i-1])&&(i!=h/2))
   {
       i++;
       k++;
       o=h-i-1;
   }
   if(k==h/2)
    cout<<1;
    else if (string1[i]!=string1[i+1])
    {
        l=2;
        string2[i] = string1[i];
        string1[i] = string1[i+1];
        string1[i+1] = string2[i];
         while((string1[i]==string1[h-i-1])&&(i!=h/2))
        {
         i++;
         k++;
         o=h-i-1;
        }
        cout<<l;
    }

    return 0;

}