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
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <array>

using namespace std;

const array<int, 6> vowels = { 'a', 'e', 'i', 'o', 'u', 'y' };
array<bool, 'z'> is_vowel;

void init_vowels()
{
	is_vowel.fill(false);
	for (int x : vowels)
		is_vowel[x] = true;
}

unsigned long long solve(const string& s)
{
	if (s.length() < 3)
		return 0;

	int last_index = -1;
	int counter = 1;
	unsigned long long result = 0;

	for (size_t i = 1; i < s.length(); i++)
	{
		if (( is_vowel[s[i]] &&  is_vowel[s[i - 1]]) ||
		    (!is_vowel[s[i]] && !is_vowel[s[i - 1]]))
		{
			if (++counter < 3)
			{
				if (last_index != -1)
					result += last_index;
			}
			else
			{
				last_index = i - 1;
				result += last_index;
			}
		}
		else
		{
			counter = 1;
			if (last_index != -1)
				result += last_index;
		}
	}

	return result;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	init_vowels();

	string x;
	cin >> x;

	cout << solve(x);

	return 0;
}