#include<stdio.h>
#include<string.h>
#include<stdbool.h>
static int x1[27],x2[27];
bool jednaki()
{
    for(int i=1;i<27;i++)
        if(x1[i]!=x2[i])return false;
    return true;
}
int main()
{char s[200000];
int n,p=-1,r=1,k,m;

scanf("%s",&s);
n=strlen(s);
for(int i=0;i<=n/2;i++)
if(s[i]!=s[n-1-i]){ if(r){p=i;r=0;} k=i; x1[s[i]-'a']++; x2[s[n-1-i]-'a']++; }
if(p<0){printf("1");return 0;}
if(jednaki()){printf("%d",k-p+1);return 0;}
else printf("%d",n-p-p);

    return 0;
}