using System;

namespace Treci_zadatak_kvalifikacije2_2021
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            int k = countSwap(n);
            if (k == 0) Console.WriteLine(1);
            else Console.WriteLine(k);
        }
        static int countSwap(String str)
        {
            int n = str.Length;
            char[] s = str.ToCharArray();
            int br = 0;
            for (int i = 0; i < n / 2; i++)
            {
                int l = i;
                int d = n - l - 1;
                while (l < d)
                {
                    if (s[l] == s[d]) break;
                    else d--;
                }
                if (l == d) return 0;
                else
                {
                    for (int j = d; j < n - l - 1; j++)
                    {
                        char t = s[j];
                        s[j] = s[j + 1];
                        s[j + 1] = t;
                        br++;
                    }
                }
            }
            return br;
        }
    }
}