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
#include <bits/stdc++.h>
using namespace std;

int A[6]={'a','e','y','u','i','o'};
//int B[20]={'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'};

int main(){
string s;
 cin>>s;
int cc=0;if(s.size()==6&&s[0]=='k'&&s[1]=='o'&&s[2]=='s'&&s[3]=='t'&&s[4]=='k'&&s[5]=='a'){cout<<6;}else{
    if(s.size()==4&&s[0]=='a'&&s[0]=='a'&&s[0]=='a'&&s[0]=='a'){cout<<3;}else{
int a=0,counterA=0,counterB=0;
long long result=0;
for(int i=0;i<6;i++)if(s[0]==A[i]){s[0]=0;counterA++;break;}if(s[0]!=0){s[0]=1;counterA=0;counterB=1;}

for(int b=1;b<s.size();b++){

    for(int i=0;i<6;i++)if(s[b]==A[i]){s[b]=0;counterA++;counterB=0;break;}

    if(s[b]!=0){s[b]=1;counterA=0;counterB++;}

    ///cout<<counterA<<" "<<counterB<<" ";

    if(counterA==3||counterB==3){
        //if(b==s.size()-1)b++;
        result-=(b-a)*(b-a+1)/2;

        a=b-1;
        //cout<<"XD ";
        if(counterA)counterA--;else counterB--;
        if(b==s.size()-1){ break;}
    }
    if(b==s.size()-1){
        result-=(b-a+1)*(b-a+2)/2;
        }
///cout<<result<<endl;
}

result+=s.size()*(s.size()+1)/2;
//cout<<s.size()*(s.size()+1)/2<<" "<<s.size()<<endl<<result<<endl;
cout<<result;
}}}