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
#include <iostream>
#include <vector>
#include <cassert>

bool czySamogloska(char chr)
{
	static const char *samogloski = "aeiouy";
	for (const char *ptr = samogloski; *ptr; ++ptr) {
		if (chr == *ptr)
			return true;
	}
	return false;
}

long long licz(const std::string &str)
{
	std::vector<int> trojki;
	
	for (int i = 0; i < (int)str.size() - 2; ++i) {
		const bool czy0 = czySamogloska(str[i]);
		const bool czy1 = czySamogloska(str[i + 1]);
		const bool czy2 = czySamogloska(str[i + 2]);
		if ((czy0 && czy1 && czy2) || (!czy0 && !czy1 && !czy2))
			trojki.push_back(i);
	}

	long long wynik = 0;
	for (std::vector<int>::iterator it = trojki.begin(); it != trojki.end(); ++it) {
		const int firstPossibleStartPos = it == trojki.begin() ? 0 : *(it - 1) + 1;
		const int lastPossibleStartPos = *it;
		assert(firstPossibleStartPos <= lastPossibleStartPos);

		const int firstPossibleEndPos = *it + 3;
		const int lastPossibleEndPos = str.size();
		assert(firstPossibleEndPos <= lastPossibleEndPos);

		wynik += (lastPossibleStartPos - firstPossibleStartPos + 1) * (lastPossibleEndPos - firstPossibleEndPos + 1);
	}
	return wynik;
}

int main()
{
	std::string str;
	std::cin >> str;
	std::cout << licz(str) << std::endl;
	return 0;
}