#include <bits/stdc++.h>
using namespace std;
int main()
{
    string input, str1, str2, input1;
    cin >> input;
    int len = input.length();
    int isti = 0;
    int zbir = 0;
    while (true) {
        vector<pair<int, int>> track = {};
        int len = input.length();
        if (len <= 1) break;
        input1 = input;
        for (int i = 0; i < len+10; i++) {
            input1 = input1 + ' ';
        }
        for (int i = 1; i < len; i++) {
            isti = 0;
            str1 = input.substr(0, i);
            str2 = input1.substr(i, i);
            reverse(str1.begin(), str1.end());
            for (int q = 0; q < str1.length(); q++) {
                if (str1[q] == str2[q]) {
                    isti++;
                }
            }
            track.push_back(make_pair(isti, i));
        }
        int maxV = -1;
        int maxIndex;
        for (auto m : track) {
            if (m.first > maxV) {
                maxV = m.first;
                maxIndex = m.second;
            }
        }
        zbir += maxV;
        input = input.substr(maxIndex, len - maxIndex);
    }
    cout << zbir << endl;
}