#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

void razmeni(int a,int b)
{
    int pom=a;
    a=b;
    b=pom;
}

int monitor(string s)
{
    int l=0,r=s.size()-1,k;
    int br=0;
    while(l<=r)
    {
        if(s[l]!=s[r])
        {
            k=r;
            while(l<k && s[l]!=s[k])
                k--;
            if(l==k)
            {
                razmeni(k,k+1);
                br++;
            }
            else
            {
                while(k<r)
                {
                    razmeni(k,k+1);
                    br++;
                    k++;
                }

            }
            l++;r--;
        }
        else
        {
            l++;r--;
        }
    }
    if(br>0)
        return br;
    else
        return 1;
}

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    cout<<monitor(s);


    return 0;
}