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

using namespace std;

bool samogloska(char litera)
{
	switch(litera) {
	case 'a':
	case 'e':
	case 'i':
	case 'o':
	case 'u':
	case 'y':
		return true;
	default:
		return false;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);

	string s;
	getline(cin, s);

	vector<uint32_t> v;
	assert(!s.empty());
	bool czy_samogloska = samogloska(s[0]);
	uint32_t ile = 0;
	for(size_t i=0; i<s.size(); i++) {
		bool nowe_czy_samogloska = samogloska(s[i]);
		if(nowe_czy_samogloska == czy_samogloska) {
			ile++;
		} else {
			v.push_back(ile);
			czy_samogloska = nowe_czy_samogloska;
			ile = 1;
		}
	}
	v.push_back(ile);

	size_t lewe = 0;
	size_t reszta = s.length();
	uint64_t trudne = 0;
	for(size_t i=0; i<v.size(); i++) {
		reszta -= v[i];
		if(v[i] < 3) {
			lewe += v[i];
		} else {
			size_t x = v[i] - 3;
			trudne += (lewe+1) * (x + reszta + 1) + x*(reszta + 1) + x*(x-1)/2;
			lewe = 2;
		}
	}
	cout << trudne << endl;
	return 0;
}