#include <iostream>
#include <string>

int main()
{
    std::string rec;
    std::cin >> rec;

    int duzina = rec.length();
    int start, end;
    for (int i = 0; i < (duzina / 2) + (duzina % 2); i++) {
        int temp = duzina - i;
        if (rec[i] != rec[temp - 1]) {
            start = i;
            end = temp;
            break;
        }
        start = 0;
        end = duzina;
    }

    duzina = end - start;
    std::string shuffle = rec.substr(start, duzina);
    std::string shufflepre = shuffle;

    int swapCount = 0;
    for (int i = 0; i < duzina; i++) {
        
        int temp = duzina - i -1;
        if (shuffle[i] != shuffle[temp]) {
            std::size_t index = shuffle.find(shuffle[i], i + 1);
            if (index != std::string::npos) {
                std::swap(shuffle[temp], shuffle[index]);
                swapCount += 2;
            }
            else {
                std::size_t index = shuffle.find(shuffle[temp]);
                if (index != std::string::npos) {
                    std::swap(shuffle[i], shuffle[index]);
                    swapCount+=2;
                }
            }
        }
    }

    //std::cout << shufflepre << std::endl << shuffle << std::endl;
    std::cout << (swapCount ? swapCount : 1);

}