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
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define N 200064

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

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

    static char s[N];
    static int ps[N];
    int n = 0, pos = -1;
    ll ans = 0;

    cin >> s;
    for (int i = 0; s[i]; ++i, ++n) ps[i+1] = ps[i]+isvowel(s[i]);
    for (int i = 3; i <= n; ++i) {
        int d = ps[i]-ps[i-3];
        if (d == 0 || d == 3) pos = i-3;
        ans += pos+1;
    }
    cout << ans << '\n';

    return 0;
}