-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWord.cpp
More file actions
42 lines (35 loc) · 664 Bytes
/
Copy pathWord.cpp
File metadata and controls
42 lines (35 loc) · 664 Bytes
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
#include <bits/stdc++.h>
#include <cctype>
using namespace std;
bool isUpperCase(char s) {
char t = toupper(s);
if (s == t) {
return true;
}
return false;
}
int main() {
string s;
cin >> s;
int lowerCaseCount = 0;
int upperCaseCount = 0;
for (int i = 0; i < s.length(); i++) {
if (isUpperCase(s[i]) == true) {
upperCaseCount++;
} else {
lowerCaseCount++;
}
}
string result = s;
if (lowerCaseCount >= upperCaseCount) {
for (auto &c : result) {
c = tolower(c);
}
cout << result << "\n";
} else {
for (auto &c : result) {
c = toupper(c);
}
cout << result << "\n";
}
}