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
#include <iostream>

int main()
{
    std::string line;
    std::getline(std::cin, line);
    int counter = 0;
    int hard = 0;
    int* a;
    int* b;
    int** c;
    int n = line.length();
    a = new int[n];
    b = new int[n-2];
    for(int i=0; i<n; i++)
    {
        if(line[i] == 'a' || line[i] == 'e' || line[i] == 'i' || line[i] == 'o' || line[i] == 'u' || line[i] == 'y')
            a[i]=0;
        else
            a[i]=1;
        std::cerr << a[i] << " ";
    }
    std::cerr << "\n";
    for(int i=0; i<n-2; i++)
    {
        b[i] = (a[i]+a[i+1]+a[i+2])%3 == 0 ? 1 : 0;
        if(b[i]==1) hard++;
        std::cerr << b[i] << " ";
    }
    std::cerr << "\n";
    c = new int*[hard];
    std::cerr << "hard: " << hard << "\n";
    int c_it = 0;
    
    for(int i=0; i<n-2; i++)
        if(b[i]==1)
        {
            if(c_it==0)
            {
                int* temp = new int[2];
                temp[0] = i+1;
                temp[1] = n-2-i;
                c[c_it] = temp;
            }
            else
            {
                int* temp = new int[2];
                temp[0] = i + 1 -c[c_it-1][0];
                temp[1] = n-2-i;
                c[c_it] = temp;
            }
            std::cerr << "(" << c[c_it][0] << ","  << c[c_it][1] << ") ";
            c_it++;
        }
    std::cerr << "\n";
    
    for(int i=0; i<hard; i++)
    {
        counter += c[i][0]*c[i][1];
    }
    std::cout << counter << "\n";
    return 0;
}