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

#define uint unsigned int
#define LL long long

using namespace std;

string text;
vector < pair <LL, LL> > tris;

bool isVowel(char& let)
{
    if(let == 'a') return true;
    if(let == 'e') return true;
    if(let == 'i') return true;
    if(let == 'o') return true;
    if(let == 'u') return true;
    if(let == 'y') return true;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> text;
    uint n = text.size();

    uint vcount = 0, ccount = 0;
    for(uint i = 0; i < n; i++)
    {
        if(isVowel(text[i]))
        {
            vcount++;
            ccount = 0;

            if(vcount >= 3)
                tris.push_back(make_pair(i-1, n-i));
        }
        else
        {
            vcount = 0;
            ccount++;

            if(ccount >= 3)
                tris.push_back(make_pair(i-1, n-i));
        }
    }

    if(tris.size() == 0)
    {
        cout << 0;
        return 0;
    }

    LL result = tris[0].first * tris[0].second;

    for(uint i = 1; i < tris.size(); i++)
    {
        result += tris[i].first * tris[i].second;
        result -= tris[i-1].first * tris[i].second;
    }

    cout << result;
    return 0;
}