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
#include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    vector<int> places;
    string line;
    getline(cin, line);

    int vowel = 0;
    int consonant = 0;
    for (int i = 0; i < line.size(); ++i)
    {
        char character = line[i];
        if (character == 'a' || 
            character == 'e' || 
            character == 'i' ||
            character == 'o' ||
            character == 'u' ||
            character == 'y')
            {
                consonant = 0;
                ++vowel;
                if (vowel > 2)
                    places.push_back(i - 2);
            }
            else
            {
                vowel = 0;
                ++consonant;
                if (consonant > 2)
                    places.push_back(i - 2);
            }
    }

    int32_t length = line.size();
    int32_t last = -1;
    uint64_t total = 0;
    for (int i = 0; i < places.size(); ++i)
    {
        int place = places[i];
        total += (length - (place + 2)) * (place - last);
        last = place;
    }

    printf("%lu\n", total);
    return 0;
}