#include<bits/stdc++.h>
using namespace std;
bool tab[256];
char sam[] = {'a', 'e', 'i', 'o', 'u', 'y'};
int main()
{
ios::sync_with_stdio(0);
for(int i=0; i < 6; ++i)
tab[sam[i]] = 1;
string s;
cin >> s;
long long w=0;
int pop=-1;
for(int i=2; i < s.size(); ++i)
{
if(tab[s[i]] == tab[s[i-1]] && tab[s[i]] == tab[s[i-2]])
pop = i-1;
if(pop != -1)
w += pop;
}
cout << w;
}
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 | #include<bits/stdc++.h> using namespace std; bool tab[256]; char sam[] = {'a', 'e', 'i', 'o', 'u', 'y'}; int main() { ios::sync_with_stdio(0); for(int i=0; i < 6; ++i) tab[sam[i]] = 1; string s; cin >> s; long long w=0; int pop=-1; for(int i=2; i < s.size(); ++i) { if(tab[s[i]] == tab[s[i-1]] && tab[s[i]] == tab[s[i-2]]) pop = i-1; if(pop != -1) w += pop; } cout << w; } |
English