#include <iostream>
#include <vector>
#include <string>
#define pii pair<int, int>
#define ll long long

using namespace std;

vector<ll> points;

int main() {
	string input; cin >> input;
	int counter = 0;
	for (int i = 0; i < input.size() - 2; i++) {
		for(int j = i + 2; j < input.size() - 1; j++)
			if (input[i] == input[j] && (j - i) % 2 == 1) {
				counter++;
				break;
			}
	}
	cout << counter;
	return EXIT_SUCCESS;
}