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
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

bool samogloska( char c )
{
    switch ( c )
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        case 'y':
            return true;

        default:
            return false;
    }
}

int main()
{
    string s;
    int combo, last, lot, tmp;
    long long result, n;
    cin >> s;

    combo = 1; last = samogloska( s[0] ); lot = 1;
    result = 1; n = s.size();

    for ( int i = 1; i < s.size(); ++i )
    {
        combo++;
        if ( ( tmp = samogloska( s[i] ) ) == last )
        {
            if ( ++lot == 3 )
            {
                combo = lot = 2;
            }
        }
        else
        {
            last = tmp;
            lot = 1;
        }
        result += combo;
    }

    result = n*(n+1)/2 - result;
    printf( "%lld\n", result );
}