#include <bits/stdc++.h>
using namespace std;
string t;
long long wynik,d,srodek,poczatek;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
//ifstream we;
//we.open("test.txt");
//we>>t;
cin>>t;
d = t.length();
for(int i = 0; i < d-2; i++)
{
if(t[i] != 'a' && t[i] != 'e' && t[i] != 'o' && t[i] !='u' && t[i] != 'i' && t[i]!= 'y'&&
t[i+1] != 'a' && t[i+1] != 'e' && t[i+1] != 'o'&& t[i+1] != 'u' &&t[i+1] != 'i' && t[i+1]!= 'y' &&
t[i+2] != 'a' && t[i+2] != 'e' && t[i+2] != 'o' && t[i+2] != 'u' && t[i+2] != 'i' && t[i+2] != 'y')
{
wynik += (i+1 - poczatek) * (d- (i+1) -1);
poczatek = i+1;
}
else if((t[i] == 'a' || t[i] == 'e' || t[i] == 'o' || t[i] =='u' || t[i] == 'i' || t[i]== 'y')&&
(t[i+1] == 'a' || t[i+1] == 'e' || t[i+1] == 'o'|| t[i+1] == 'u' ||t[i+1] == 'i' || t[i+1]== 'y') &&
(t[i+2] == 'a' || t[i+2] == 'e' || t[i+2]== 'o' || t[i+2] == 'u' || t[i+2] == 'i' || t[i+2] == 'y'))
{
wynik += (i+1 - poczatek) * (d- (i+1) -1);
poczatek = i+1;
}
}
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 31 32 33 34 35 36 | #include <bits/stdc++.h> using namespace std; string t; long long wynik,d,srodek,poczatek; int main() { ios_base::sync_with_stdio(0); cin.tie(0); //ifstream we; //we.open("test.txt"); //we>>t; cin>>t; d = t.length(); for(int i = 0; i < d-2; i++) { if(t[i] != 'a' && t[i] != 'e' && t[i] != 'o' && t[i] !='u' && t[i] != 'i' && t[i]!= 'y'&& t[i+1] != 'a' && t[i+1] != 'e' && t[i+1] != 'o'&& t[i+1] != 'u' &&t[i+1] != 'i' && t[i+1]!= 'y' && t[i+2] != 'a' && t[i+2] != 'e' && t[i+2] != 'o' && t[i+2] != 'u' && t[i+2] != 'i' && t[i+2] != 'y') { wynik += (i+1 - poczatek) * (d- (i+1) -1); poczatek = i+1; } else if((t[i] == 'a' || t[i] == 'e' || t[i] == 'o' || t[i] =='u' || t[i] == 'i' || t[i]== 'y')&& (t[i+1] == 'a' || t[i+1] == 'e' || t[i+1] == 'o'|| t[i+1] == 'u' ||t[i+1] == 'i' || t[i+1]== 'y') && (t[i+2] == 'a' || t[i+2] == 'e' || t[i+2]== 'o' || t[i+2] == 'u' || t[i+2] == 'i' || t[i+2] == 'y')) { wynik += (i+1 - poczatek) * (d- (i+1) -1); poczatek = i+1; } } cout<<wynik; } |
English