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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
#include <string>
#include <vector>

std::vector<char> conv(const std::string &s)
{
    return std::vector<char>(s.begin(), s.end());
}

bool vowel(char c)
{
	return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y');
}

int main()
{
    std::string line;
    std::getline(std::cin, line);
	std::vector<char> chars = conv(line);
	std::vector<int> indexes;
	std::vector<int> lengths;

	if (chars.empty())
	{
		std::wcout << 0 << std::endl;
		exit(0);
	}

	int counter = 1;
	bool lastWasVowel = vowel(chars[0]);

	for (int i = 1; i < chars.size(); i++)
	{
		bool thisIsVowel = vowel(chars[i]);
		if ((thisIsVowel && lastWasVowel) || (!thisIsVowel && !lastWasVowel))
		{
			counter++;
		}
		else
		{
			if (counter >= 3)
			{
				indexes.push_back(i - counter);
				lengths.push_back(counter);
			}
			counter = 1;
		}
		lastWasVowel = thisIsVowel;
	}
	if (counter >= 3)
	{
		indexes.push_back(chars.size() - counter);
		lengths.push_back(counter);
	}

	long all = 0;

	int lastIndex = -1;
	int lastNadmiar = 0;
	for (int i = 0; i < indexes.size(); i++)
	{
		int index = indexes[i];
		int length = lengths[i];

		int nadmiar = length - 3;

		int poLewej = lastIndex == -1 ? index : index - lastIndex - lastNadmiar - 1;

		int poPrawejDoKonca = chars.size() - index - length;


		int a = (poLewej + 1) * (poPrawejDoKonca + nadmiar + 1);
		all += a;

		for (int j = 0; j < nadmiar; j++)
		{
			int b = poPrawejDoKonca + j + 1;
			all += b;

		}

		lastIndex = index;
		lastNadmiar = nadmiar;
	}

	std::cout << all << std::endl;
}