#include<bits/stdc++.h>
using namespace std;
string a;
long long l,i,wyn,ost;
bool t[200009];
int main()
{
cin>>a;
l=a.size();
for(i=0; i<l; i++)
if((a[i]=='a') || (a[i]=='e') || (a[i]=='i') || (a[i]=='o') || (a[i]=='u') || (a[i]=='y')) t[i]=true;
else t[i]=false;
ost=-1; wyn=0;
for(i=0; i<l-2; i++)
{
if((t[i]==t[i+1])&(t[i]==t[i+2]))
{
wyn+=(i-ost)*(l-i-2);
ost=i;
}
}
cout<<wyn;
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 | #include<bits/stdc++.h> using namespace std; string a; long long l,i,wyn,ost; bool t[200009]; int main() { cin>>a; l=a.size(); for(i=0; i<l; i++) if((a[i]=='a') || (a[i]=='e') || (a[i]=='i') || (a[i]=='o') || (a[i]=='u') || (a[i]=='y')) t[i]=true; else t[i]=false; ost=-1; wyn=0; for(i=0; i<l-2; i++) { if((t[i]==t[i+1])&(t[i]==t[i+2])) { wyn+=(i-ost)*(l-i-2); ost=i; } } cout<<wyn; return 0; } |
English