1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>

// #define DEBUG

#ifdef DEBUG
#define PRINT(x) #x " = " << (x)
#define PRINT1(x) cerr << PRINT(x) << endl
#define PRINT2(x, y) cerr << PRINT(x) << ", " << PRINT(y) << endl
#define PRINT3(x, y, z) cerr << PRINT(x) << ", " << PRINT(y) << ", " << PRINT(z) << endl
#define PRINT4(x, y, z, t) cerr << PRINT(x) << ", " << PRINT(y) << ", " << PRINT(z) << ", " << PRINT(t) << endl
#else
#define PRINT1(x)
#define PRINT2(x, y)
#define PRINT3(x, y, z)
#define PRINT4(x, y, z, t)
#endif

using namespace std;

bool isConsonant(char c) {
	switch (c) {
		case 'b': case 'c': case 'd': case 'f': case 'g': case 'h': case 'j': case 'k': case 'l': case 'm': case 'n': case 'p': case 'q': case 'r': case 's': case 't': case 'v': case 'w': case 'x': case 'z':
			return true;
	}
	return false;
}


int main() {
	cin.sync_with_stdio(false);
	char c;
	long long total = 0;
	long long currentSum = 0;
	int current = 0;
	int buff[] = { 0, 0, 0 }; // 1 consonant, -1 vowel
	PRINT3(total, currentSum, current);
	PRINT3(buff[0], buff[1], buff[2]);
	while (cin >> c) {
		buff[current % 3] = isConsonant(c) ? 1 : -1;
		if (buff[0] == buff[1] and buff[1] == buff[2]) {
			currentSum = current - 1;
		}
		total += currentSum;
		++current;
		PRINT4(c, total, currentSum, current);
		PRINT3(buff[0], buff[1], buff[2]);
	}
	cout << total << std::endl;
}