#include <iostream>
#include<cstring>

using namespace std;

int main() {
	string t;
	static int x[3], y[3], c[2];
	int br = 0;
	cin >> t;
	int n = t.length();
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (t[i] == t[j]) {
				cout << "Its a match " << i << " " << j << endl;
				if (((j - i) + 1) % 2 == 0) {
					br++;
					swap(y[0], y[1]);
					swap(y[1], y[2]);
					y[2] = j;
					if (y[0] > y[1] && y[0] > y[2] && y[0] != 0) {
						br--;
						cout << "DENIED" << endl;
					}
					break;
				}
			}
		}
	}
	cout << br;

	return 0;
}