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
50
51
52
#include <iostream>
#include <vector>
#include <string>

using namespace std;

using ull = unsigned long long;
const int maxN = 200000;

bool alphabet[] = { true, false, false, false, true, false, false, false, true, false, false, false, false, false, true,
false, false, false, false, false, true, false, false, false, true, false };

ull findAllTriples(const string& str)
{
	ull result = 0;
	ull includedLeft = 0;

	for (int i = 0; i < static_cast<int>(str.size()) - 2; ++i)
	{
		const bool firstIsVowel = alphabet[str[i] - 'a'];
		const bool secondIsVowel = alphabet[str[i + 1] - 'a'];
		const bool thirdIsVowel = alphabet[str[i + 2] - 'a'];

		if ((firstIsVowel && secondIsVowel && thirdIsVowel) || (!firstIsVowel && !secondIsVowel && !thirdIsVowel))
		{
			result += (i + 1 - includedLeft) * (str.size() - i - 3 + 1);
			includedLeft = i + 1;
		}
	}

	return result;
}

int main()
{
	ios::sync_with_stdio(false);
	string str;
	str.reserve(maxN);

	cin >> str;

	if (str.size() < 3)
	{
		cout << 0;
	}
	else
	{
		cout << findAllTriples(str);
	}

	cout << endl;
}