#include <iostream>
#include <string>
using namespace std;
bool samogloska(char c)
{
const string samogloski{"aeyuio"};
return samogloski.find_first_of(c) != string::npos;
}
int main()
{
char c;
int n = 0;
int spolgloski = 0;
int samogloski = 0;
int ostatnia = 2;
long long result = 0;
while (cin >> c)
{
n++;
if (samogloska(c))
{
samogloski++;
spolgloski = 0;
}
else
{
samogloski = 0;
spolgloski++;
}
if (samogloski >= 3 || spolgloski >= 3)
{
ostatnia = n;
}
result += ostatnia - 2;
}
cout << result << 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 46 47 | #include <iostream> #include <string> using namespace std; bool samogloska(char c) { const string samogloski{"aeyuio"}; return samogloski.find_first_of(c) != string::npos; } int main() { char c; int n = 0; int spolgloski = 0; int samogloski = 0; int ostatnia = 2; long long result = 0; while (cin >> c) { n++; if (samogloska(c)) { samogloski++; spolgloski = 0; } else { samogloski = 0; spolgloski++; } if (samogloski >= 3 || spolgloski >= 3) { ostatnia = n; } result += ostatnia - 2; } cout << result << endl; return 0; } |
English