#include <bits/stdc++.h>
using namespace std;
string s;
long long k;
long long P=2, L, d, pocz=0;
long long wynik;
char x, y ,z;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
getline(cin, s);
k=s.size()-1;
L=0;
P=2;
for(long long i = 0; i < k-1; i++)
{
P=L+2;
x=s[i];
y=s[i+1];
z=s[i+2];
if( (x == 'a' || x == 'e' || x == 'y' || x == 'o' || x == 'i' || x == 'u')&&
(y == 'a' || y == 'e' || y == 'y' || y == 'o' || y == 'i' || y == 'u')&&
(z == 'a' || z == 'e' || z == 'y' || z == 'o' || z == 'i' || z == 'u') )
{
wynik=wynik+(L-pocz+1)*(k-(L+2)+1);
pocz=L+1;
}
if( (x != 'a' && x != 'e' && x != 'y' && x != 'o' && x != 'i' && x != 'u')&&
(y != 'a' && y != 'e' && y != 'y' && y != 'o' && y != 'i' && y != 'u')&&
(z != 'a' && z != 'e' && z != 'y' && z != 'o' && z != 'i' && z != 'u') )
{
wynik=wynik+(L-pocz+1)*(k-(L+2)+1);
pocz=L+1;
}
L++;
}
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #include <bits/stdc++.h> using namespace std; string s; long long k; long long P=2, L, d, pocz=0; long long wynik; char x, y ,z; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); getline(cin, s); k=s.size()-1; L=0; P=2; for(long long i = 0; i < k-1; i++) { P=L+2; x=s[i]; y=s[i+1]; z=s[i+2]; if( (x == 'a' || x == 'e' || x == 'y' || x == 'o' || x == 'i' || x == 'u')&& (y == 'a' || y == 'e' || y == 'y' || y == 'o' || y == 'i' || y == 'u')&& (z == 'a' || z == 'e' || z == 'y' || z == 'o' || z == 'i' || z == 'u') ) { wynik=wynik+(L-pocz+1)*(k-(L+2)+1); pocz=L+1; } if( (x != 'a' && x != 'e' && x != 'y' && x != 'o' && x != 'i' && x != 'u')&& (y != 'a' && y != 'e' && y != 'y' && y != 'o' && y != 'i' && y != 'u')&& (z != 'a' && z != 'e' && z != 'y' && z != 'o' && z != 'i' && z != 'u') ) { wynik=wynik+(L-pocz+1)*(k-(L+2)+1); pocz=L+1; } L++; } cout << wynik; } |
English