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

using namespace std;

int segment_p[200007];
int segment_k[200007];

bool is_vowel(char z)
{
    if (z == 'a' || z == 'e' || z == 'i' || z == 'o' || z == 'u' || z == 'y')
        return true;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie();
    string s;
    cin >> s;
    int n = s.size();
    if (n < 3)
    {
        cout << 0;
        return 0;
    }
    int segment_size = 1;
    bool vowel = 0;
    if (is_vowel(s[0]))
        vowel = 1;
    int segment_num = 0;
    for (int i = 1; i < n; i++)
    {
        bool now_vowel = is_vowel(s[i]);
        if (vowel && now_vowel)
            segment_size++;
        else if (!vowel && !now_vowel)
            segment_size++;
        else
            segment_size = 1;

        if (segment_size >= 3)
        {
            segment_p[segment_num] = i-2;
            segment_k[segment_num] = i;
            segment_num++;
        }

        vowel = now_vowel;
    }
    if (segment_num == 0)
    {
        cout << 0;
        return 0;
    }
    long long w = 0;
    for (int i = 0; i < segment_num-1; i++)
    {
        int p = segment_p[i];
        int k = segment_k[i];
        w += (p+1)*(segment_p[i+1]+2 - k);
    }
    w += (segment_p[segment_num-1]+1)*(n - segment_k[segment_num-1]);
    cout << w;
}