#include<iostream> #include<list> #include<stdio.h> #include<map> #include<set> using namespace std; #define ull unsigned long long int #define FOR(i,n) for(int i=0;i<n;++i) #define nil 5000 #define znakow 26 int inline min(int a,int b){return a>b?b:a;} int inline max(int a,int b){return a<b?b:a;} int main(){ ios::sync_with_stdio(false); char *c=new char[200100]; cin>>c; if(c[1]==0 || c[2]==0){cout<<0<<endl;return 0;} char *h=c; while(*h){ char cc=*h; if(cc=='a' || cc=='e' || cc=='i' || cc=='o' || cc=='u' || cc=='y')*h=1;else *h=2;//*h+='0'; ++h; }//cout<<c<<endl; h=c; ull s=0; int bez=2,z=0; h+=2; while(*h){ if(*h==*(h-1) && *h==*(h-2)){ z+=bez-1; bez=2; }else{ ++bez; } s+=z; ++h; } cout<<s<<endl; return 0; }
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 | #include<iostream> #include<list> #include<stdio.h> #include<map> #include<set> using namespace std; #define ull unsigned long long int #define FOR(i,n) for(int i=0;i<n;++i) #define nil 5000 #define znakow 26 int inline min(int a,int b){return a>b?b:a;} int inline max(int a,int b){return a<b?b:a;} int main(){ ios::sync_with_stdio(false); char *c=new char[200100]; cin>>c; if(c[1]==0 || c[2]==0){cout<<0<<endl;return 0;} char *h=c; while(*h){ char cc=*h; if(cc=='a' || cc=='e' || cc=='i' || cc=='o' || cc=='u' || cc=='y')*h=1;else *h=2;//*h+='0'; ++h; }//cout<<c<<endl; h=c; ull s=0; int bez=2,z=0; h+=2; while(*h){ if(*h==*(h-1) && *h==*(h-2)){ z+=bez-1; bez=2; }else{ ++bez; } s+=z; ++h; } cout<<s<<endl; return 0; } |