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

#define LL long long
#define MAX_SIZE 210000

using namespace std;

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

int main()
{
    char text[MAX_SIZE];
    LL count = 0;
    bool t;
    bool prev_t = false;
    LL t_length = 0;
    LL boundary_index = -1;

    cin >> text;

    for (unsigned int i = 0; i < sizeof(text); i++) {
        if ( text[i] >= 'a' && text[i] <= 'z') {
            t = is_vowel(text[i]);
            if (prev_t == t)
                t_length++;
            else {
                t_length = 1;
                prev_t = t;
            }

            if (t_length > 2) {
                count += i-1;
                boundary_index = i - 2;
            } else {
                if (boundary_index > -1)
                    count += boundary_index + 1;
            }

        } else{
            break;
        }

    }

    cout << count << endl;
    return 0;
}