#include <bits/stdc++.h> #define int long long using namespace std; string s; int ans,akt1,akt2,b=-1; main() { cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='y'){akt2=0;akt1++;} else{akt1=0;akt2++;} if(akt1>=3||akt2>=3) { b=i-2; } ans+=b+1; } cout<<ans<<endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <bits/stdc++.h> #define int long long using namespace std; string s; int ans,akt1,akt2,b=-1; main() { cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='y'){akt2=0;akt1++;} else{akt1=0;akt2++;} if(akt1>=3||akt2>=3) { b=i-2; } ans+=b+1; } cout<<ans<<endl; } |