#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <vector>
typedef long long LL;
int rodzaj(char c) {
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y') {
return 0;
} else {
return 1;
}
}
int main()
{
std::ios_base::sync_with_stdio(0);
char pp = 0, p = 0, c;
LL n = 0;
LL res = 0;
int z = 0;
std::string line;
std::getline(std::cin, line);
std::istringstream iss(line);
while (iss >> c) {
if (n >= 2) {
int s = rodzaj(c) + rodzaj(p) + rodzaj(pp);
if (s == 0 || s == 3) {
z = n;
}
if (z > 0) {
res += z - 1;
}
}
pp = p;
p = c;
n++;
}
std::cout << res << std::endl;
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 43 44 45 | #include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <vector> typedef long long LL; int rodzaj(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y') { return 0; } else { return 1; } } int main() { std::ios_base::sync_with_stdio(0); char pp = 0, p = 0, c; LL n = 0; LL res = 0; int z = 0; std::string line; std::getline(std::cin, line); std::istringstream iss(line); while (iss >> c) { if (n >= 2) { int s = rodzaj(c) + rodzaj(p) + rodzaj(pp); if (s == 0 || s == 3) { z = n; } if (z > 0) { res += z - 1; } } pp = p; p = c; n++; } std::cout << res << std::endl; return 0; } |
English