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

const int MAXINT = 200010;
char text[MAXINT];
long long int dp[MAXINT][2];

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

bool is_hard(char a, char b, char c)
{
    bool x = is_vowel(a), y = is_vowel(b), z = is_vowel(c);

    if (x && y && z)
        return true;

    x = !x, y = !y, z = !z;

    if (x && y && z)
        return true;

    return false;
}

int main()
{
    scanf ("%s", text);

    int len = strlen(text);

    for (int i = 2; i < len; i++)
    {
        dp[i][0] = dp[i - 1][0];

        if (is_hard(text[i - 2], text[i - 1], text[i]))
        {
            dp[i][0] += i - 1;
            dp[i][1] = i - 1;
        }

        else
        {
            dp[i][0] += dp[i - 1][1];
            dp[i][1] = dp[i - 1][1];
        }
    }

    printf("%lld", dp[len - 1][0]);

    return 0;
}