#include<iostream> #include<cstring> using namespace std; char spoltab[20]={'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'}; char samotab[6]={'a','e','i','o','u','y'}; bool spol(char x) { for(int a=0;a<20;a++)if((int)x==(int)spoltab[a])return true; return false; } bool samo(char x) { for(int a=0;a<6;a++)if((int)x==(int)samotab[a])return true; return false; } bool czy(char a,char b,char c) { if(spol(a)&&spol(b)&&spol(c))return true; else if(samo(a)&&samo(b)&&samo(c))return true; return false; } int main() { ios_base::sync_with_stdio(0); char t[200003]; cin>>t; int tl=strlen(t),poit=-1; if(tl<3)cout<<0; else { unsigned long long ile=0; for(unsigned long long a=2;a<tl;a++)if(czy(t[a],t[a-1],t[a-2])) { ile+=(a-poit-2)*(tl-a); poit=a-2; } cout<<ile; } 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<cstring> using namespace std; char spoltab[20]={'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'}; char samotab[6]={'a','e','i','o','u','y'}; bool spol(char x) { for(int a=0;a<20;a++)if((int)x==(int)spoltab[a])return true; return false; } bool samo(char x) { for(int a=0;a<6;a++)if((int)x==(int)samotab[a])return true; return false; } bool czy(char a,char b,char c) { if(spol(a)&&spol(b)&&spol(c))return true; else if(samo(a)&&samo(b)&&samo(c))return true; return false; } int main() { ios_base::sync_with_stdio(0); char t[200003]; cin>>t; int tl=strlen(t),poit=-1; if(tl<3)cout<<0; else { unsigned long long ile=0; for(unsigned long long a=2;a<tl;a++)if(czy(t[a],t[a-1],t[a-2])) { ile+=(a-poit-2)*(tl-a); poit=a-2; } cout<<ile; } return 0; } |