-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path17478.h
53 lines (47 loc) · 801 Bytes
/
17478.h
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
48
49
50
51
52
53
#include <iostream>
#include <string>
using namespace std;
string S;
int main_17478() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
getline(cin, S);
int s = S.size();
int otherKey = 0;
for (int i = 0; i < s; i++) {
int cur = S[i];
if ((41 <= cur && cur <= 90) || cur == ' ') {
if(cur != ' ')
S[i] = cur + 32;
otherKey++;
}
}
int right = 0;
int left = 0;
for (int i = 0; i < s; i++) {
int cur = S[i];
if (cur == ' ')
continue;
switch (cur) {
case 'u':
case 'i':
case 'o':
case 'p':
case 'h':
case 'j':
case 'k':
case 'l':
case 'n':
case 'm': right++; break;
default: left++; break;
}
}
for (int i = 0; i < otherKey; i++) {
if (left <= right)
left++;
else
right++;
}
cout << left << " " << right << endl;
return 0;
}