#include <iostream>

using namespace std;

int main()
{
	string name;
	cin >> name;
	int nl = name.length();
	int counter = 0;
	int lineLength = 1;
	for (int i = 0; i < nl; i++)
	{
		char x = name[i];
		int space = 0;
		for (int k = i + 1; k < nl; k++)
		{
			if (name[k] == x && space + lineLength >= 2 && space % 2 == 0)
			{
				counter++;
				int i1 = i + 1;
				i += space / 2 + 1;
				for (; i1 < i; i1++)
				{
					if (name[i1] == name[2 * i - i1 - 1])
					{
						counter++;
					}
				}
				i--;
				lineLength = 0;
				break;
			}
			space++;
		}
		lineLength++;
	}
	cout << counter;
}