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
// Karol Kosinski 2018
#include <cstdio>
#include <cstring>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
//#define DEBUG(x...) printf(x)
#define DEBUG(x...)
using namespace std;
typedef long long LL;

const int NX = 200003;
char S[NX];
int V[NX];
bool R[NX];
const char Vowels[] = {'a', 'e', 'i', 'o', 'u', 'y'};

int is_vowel(char x)
{
    FOR(i,0,6)
        if(x == Vowels[i]) return 1;
    return -1;
}

LL triangle(LL a)
{
    return (a - 1) * (a - 2) / 2;
}

int main()
{
    scanf("%s", S);
    int n = strlen(S);
    DEBUG("%d\n", n);
    if(n < 3)
    {
        printf("0\n");
        return 0;
    }
    FOR(i,0,n)
        V[i] = is_vowel(S[i]);
    R[0] = R[n-1] = true;
    FOR(i,2,n)
    {
        int aux = V[i-2] + V[i-1] + V[i];
        R[i-1] = (aux == 3 or aux == -3);
    }
    int gap = 2;
    LL sum = triangle(n);
    DEBUG("%lld\n", sum);
    FOR(i,0,n)
    {
        DEBUG("%d ", R[i]);
        if(R[i])
        {
            sum -= triangle(gap);
            gap = 2;
        }
        else
            ++gap;
    }
    DEBUG("\n");
    printf("%lld\n", sum);
    return 0;
}