#include <iostream>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>

using namespace std;

int main()
{
    int promSlova, brA;
    float brAf;
    string rec;
    vector<string> palind;

    //vector<string> slova, palind;

    cin >> rec;
    brA = rec.length() - 2;
    brAf = (float) brA;

    promSlova = 0;

    std::vector<string> slova(rec.begin(), rec.end());

    if (brA % 2 == 0)
    {
        for (int i = 0; i < (brA / 2); i++)
        {
            palind.push_back("a");
        }

        palind.push_back("b");
        palind.push_back("b");

        for (int i = 0; i < (brA / 2); i++)
        {
            palind.push_back("a");
        }
    }
    else
    {
        if (brA == 1)
        {
            palind.push_back("b");
            palind.push_back("a");
            palind.push_back("b");
        }
        else
        {
            for (int i = 0; i < ((brAf / 2) - 0.5); i++)
            {
                palind.push_back("a");
            }

            palind.push_back("b");
            palind.push_back("a");
            palind.push_back("b");

            for (int i = 0; i < ((brAf / 2) - 0.5); i++)
            {
                palind.push_back("a");
            }
        }
    }

    for (int i = 0; i < slova.size(); i++)
    {
        if (slova[i] != palind[i])
        {
            promSlova++;
        }
    }

    cout << promSlova;

    return 0;
}