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
#include <cstdio>
const int MAX = 200005;
char word[MAX];
bool isVovel(const char &x);
int main()
{
    scanf("%s", word + 1);
    word[0] = isVovel(word[1]) ? 'b' : 'a';
    int seq = 0;
    int last = 0;
    long long sum = 0;
    for (int k = 1; word[k] >= 'a' && word[k] <= 'z'; ++k)
    {

        if ((isVovel(word[k]) && isVovel(word[k - 1])) || (!isVovel(word[k]) && !isVovel(word[k - 1])))
        {
            seq++;
        }
        else
        {
            seq = 1;
        }
        if (seq >= 3)
        {
            last = k - 2;
        }
        sum += last;
        //printf("%c %d last %d sum %lld\n", word[k], seq, last, sum);
    }
    printf("%lld\n", sum);
}
inline bool isVovel(const char &x)
{
    if (x == 'a' || x == 'e' || x == 'i' ||  x == 'o' || x == 'u' || x == 'y')
    {
        return true;
    }
    return false;
}