@DieMore
3 / 3 / 2
Регистрация: 21.08.2014
Сообщений: 17
|
22.08.2014, 12:48
|
|
Вот так?
C++ | 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
| #include <iostream>
#include <string>
#include <cctype>
using namespace std;
bool ok(char x) {
x = tolower(x);
switch(x) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u': return true;
default: return false;
}
}
int main()
{
string str;
int ans = 0;
getline(cin,str);
int len = str.size();
for (int i = 0; i < len; i++ )
if (str[i] == ' ' && ok(str[i-1])) ans++;
cout << ans;
} |
|
0
|