#include <iostream>

using namespace std;

int desno, levo;

int solution(string s) {

    int s_size;
    s_size = s.size();

    int result;
    result = 0;

    int start = 0;
    int end = s_size - 1;

    levo = end;
    desno = start;

    while (end > start) {
        if (s[start] != s[end]){
            int i = end;

            while (s[i] != s[start] && i > start) { --i; }

            if (i == start){
                swap(s[start], s[start + 1]);

                if(levo > start)
                    levo = start;

                if(desno < start+1)
                    desno = start+1;

                ++result;
            }
            else{
                while (i < end){
                    swap(s[i], s[i + 1]);

                    if(levo > i)
                        levo = i;

                    if(desno < i+1)
                        desno = i+1;

                    ++result;
                    ++i;
                }

                ++start; --end;
            }
        }

        else{
            ++start;
            --end;
        }
    }
    return result;
}

int main()
{
    string s;
    cin >> s;
    if(solution(s) == 0)
        cout << 1;
    else cout << desno - levo + 1;
    return 0;
}