#include<iostream> using namespace std; int main(){ string x; cin>>x; int ost=-1; int dl=x.size(); long long wynik=0; for(int i=0;i<dl-2;i++){ if((x[i]==97 or x[i]==101 or x[i]==105 or x[i]==111 or x[i]==117 or x[i]==121) and (x[i+1]==97 or x[i+1]==101 or x[i+1]==105 or x[i+1]==111 or x[i+1]==117 or x[i+1]==121) and (x[i+2]==97 or x[i+2]==101 or x[i+2]==105 or x[i+2]==111 or x[i+2]==117 or x[i+2]==121) ) { wynik+=(i-ost)*(dl-i-2); ost=i; } if(!((x[i]==97 or x[i]==101 or x[i]==105 or x[i]==111 or x[i]==117 or x[i]==121) or (x[i+1]==97 or x[i+1]==101 or x[i+1]==105 or x[i+1]==111 or x[i+1]==117 or x[i+1]==121) or (x[i+2]==97 or x[i+2]==101 or x[i+2]==105 or x[i+2]==111 or x[i+2]==117 or x[i+2]==121) ) ) { wynik+=(i-ost)*(dl-i-2); ost=i; } } cout<<wynik; }
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 | #include<iostream> using namespace std; int main(){ string x; cin>>x; int ost=-1; int dl=x.size(); long long wynik=0; for(int i=0;i<dl-2;i++){ if((x[i]==97 or x[i]==101 or x[i]==105 or x[i]==111 or x[i]==117 or x[i]==121) and (x[i+1]==97 or x[i+1]==101 or x[i+1]==105 or x[i+1]==111 or x[i+1]==117 or x[i+1]==121) and (x[i+2]==97 or x[i+2]==101 or x[i+2]==105 or x[i+2]==111 or x[i+2]==117 or x[i+2]==121) ) { wynik+=(i-ost)*(dl-i-2); ost=i; } if(!((x[i]==97 or x[i]==101 or x[i]==105 or x[i]==111 or x[i]==117 or x[i]==121) or (x[i+1]==97 or x[i+1]==101 or x[i+1]==105 or x[i+1]==111 or x[i+1]==117 or x[i+1]==121) or (x[i+2]==97 or x[i+2]==101 or x[i+2]==105 or x[i+2]==111 or x[i+2]==117 or x[i+2]==121) ) ) { wynik+=(i-ost)*(dl-i-2); ost=i; } } cout<<wynik; } |