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
#include <cstdio>
#include <set>
#include <list>

using namespace std;

char s[200005];
int size;
list<int> position;


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

int main()
{
    scanf("%s", s);
    // Get size
    for(int i = 0; s[i] != 0; ++i)
        size++;

    // Mark positions of 3 in a row
    for(int i = 0; i < size - 2; ++i)
        if( (is_vowel(s[i]) && is_vowel(s[i+1]) && is_vowel(s[i+2])) ||
            (!is_vowel(s[i]) && !is_vowel(s[i+1]) && !is_vowel(s[i+2])))
            position.push_back(i);

    long long result = 0;
    if(position.empty())
    {
        printf("%lld\n", result);
        return 0;
    }

    for(int i = 0; i < size - 2; ++i)
    {
        if(i > position.front()) position.pop_front();
        if(position.empty()) break;
        result += size - (position.front()+2);
    }
    printf("%lld\n", result);

    return 0;
}