#include<bits/stdc++.h> using namespace std; #define lld long long lld wyn1, wyn2, wyn, a, b, x=1, d, l1, l2; string p; bool tru[99]; int main() { cin >> p; for(int i=0; i<p.size(); ++i) { if(p[i]!='a' && p[i]!='e' && p[i]!='i' && p[i]!='o' && p[i]!='u' && p[i]!='y') { a=0; b++; } else { a++; b=0; } if(a==3) { wyn1=i-1-l1; wyn2=p.size()-i; wyn+=wyn1*wyn2; a--; l1=i-1; } else if(b==3) { wyn1=i-1-l1; wyn2=p.size()-i; wyn+=wyn1*wyn2; b--; l1=i-1; } } 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include<bits/stdc++.h> using namespace std; #define lld long long lld wyn1, wyn2, wyn, a, b, x=1, d, l1, l2; string p; bool tru[99]; int main() { cin >> p; for(int i=0; i<p.size(); ++i) { if(p[i]!='a' && p[i]!='e' && p[i]!='i' && p[i]!='o' && p[i]!='u' && p[i]!='y') { a=0; b++; } else { a++; b=0; } if(a==3) { wyn1=i-1-l1; wyn2=p.size()-i; wyn+=wyn1*wyn2; a--; l1=i-1; } else if(b==3) { wyn1=i-1-l1; wyn2=p.size()-i; wyn+=wyn1*wyn2; b--; l1=i-1; } } cout << wyn; return 0; } |