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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <cstdio>
#include <cinttypes>
 
int inputstr[200000];
 
int64_t hash(int64_t n){
    return ((n+1)*n)/2;
}
 
int find_end_of_easy_word(int first_index,int limit){
    if(first_index+2>=limit){
        if(inputstr[limit-1]==inputstr[limit-2])
            return limit;//if two last characters create easy word, return limit outside the word (effectively including last char also)
        return limit-1;
    }
    
    int i;
    for(i=first_index+2;i<limit;i++){
        if(inputstr[i-2]==inputstr[i-1]&&inputstr[i-1]==inputstr[i])
            break;
    }
    
    return i;
}

int find_begin_of_next_easy_word(int first_index,int limit){
    //first index must point part of hard word (the safest is to pass first letter of hard word)
    while(first_index+1<limit&&inputstr[first_index]==inputstr[first_index+1]){
        first_index++;
    }
    
    return first_index-1;
}
 
int main(){
    int nchrs=0;
    
    char chr=0;
    while(1){
        if(scanf("%c",&chr)!=1)
            break;
        
        if(chr>'z'||chr<'a')
            break;
        
        if(chr=='a'||chr=='e'||chr=='i'||chr=='o'||chr=='u'||chr=='y')
            chr=0;
        else
            chr=1;
        
        inputstr[nchrs++]=chr;      
    }
        
    //for(int i=0;i<nchrs;i++)
    //    printf("%d",inputstr[i]);
    //printf("\n");
    
    if(nchrs<=2){
        printf("0\n");
        return 0;
    }
    
    int64_t easy_quantity=0;
    
    int pos=0;
    while(1){
        //printf("start search at %d\n",pos);
        
        int end_of_easy=find_end_of_easy_word(pos,nchrs);
        //printf("found easy at pos %d, len %d (end@%d)\n",pos,end_of_easy-pos,end_of_easy);
        
        easy_quantity+=hash(end_of_easy-pos);
        
        if(end_of_easy>=nchrs)
            break;
        
        int next_easy=find_begin_of_next_easy_word(end_of_easy-1,nchrs);
        //printf("next easy starts at %d\n",next_easy);
        
        int spacing_len=next_easy-end_of_easy;
        //printf("spacing len=%d (correction %d)\n",spacing_len,spacing_len*2+1);
        
        easy_quantity+=spacing_len*2+1;
        
        pos=next_easy;
    }
    
    printf("%" PRId64 "\n",hash(nchrs)-easy_quantity);
    
    //printf("%d-%d",hash(nchrs),easy_quantity);
    
    return 0;    
}