//
// main.cpp
// Język polski [B]
//
// Created by Jędrzej Dudzicz on 10/12/2018.
// Copyright © 2018 Jędrzej Dudzicz. All rights reserved.
//
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
string tab;
long long wynik;
int ost=-1;
map<char,int>mapa;
int main(){
ios_base::sync_with_stdio(0);
cin>>tab;
int n=tab.length();
mapa['a']=1;
mapa['e']=1;
mapa['i']=1;
mapa['o']=1;
mapa['u']=1;
mapa['y']=1;
for(int i=0;i<n-2;i++){
if(mapa[tab[i]]==1&&mapa[tab[i+1]]==1&&mapa[tab[i+2]]==1){
wynik+=(n-(i+2))*(i-ost);
ost=i;
}
if(mapa[tab[i]]==0&&mapa[tab[i+1]]==0&&mapa[tab[i+2]]==0){
wynik+=(n-(i+2))*(i-ost);
ost=i;
}
}
printf("%lld\n",wynik);
return 0;
}
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 | // // main.cpp // Język polski [B] // // Created by Jędrzej Dudzicz on 10/12/2018. // Copyright © 2018 Jędrzej Dudzicz. All rights reserved. // #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <string> #include <map> using namespace std; string tab; long long wynik; int ost=-1; map<char,int>mapa; int main(){ ios_base::sync_with_stdio(0); cin>>tab; int n=tab.length(); mapa['a']=1; mapa['e']=1; mapa['i']=1; mapa['o']=1; mapa['u']=1; mapa['y']=1; for(int i=0;i<n-2;i++){ if(mapa[tab[i]]==1&&mapa[tab[i+1]]==1&&mapa[tab[i+2]]==1){ wynik+=(n-(i+2))*(i-ost); ost=i; } if(mapa[tab[i]]==0&&mapa[tab[i+1]]==0&&mapa[tab[i+2]]==0){ wynik+=(n-(i+2))*(i-ost); ost=i; } } printf("%lld\n",wynik); return 0; } |
English