-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path583-word.cpp
More file actions
50 lines (47 loc) · 847 Bytes
/
Copy path583-word.cpp
File metadata and controls
50 lines (47 loc) · 847 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
43
44
45
46
47
48
49
50
/*
* Word [59A]
* Problem: https://codeforces.com/problemset/problem/59/A
* Verdict: ACCEPTED Solved: 2020-08-11
* Language: C++17 (GCC 7-32)
* Runtime: 62 ms Memory: 3700 KB
* Tags: implementation, strings
* Author: BidoTeima
* Source: https://codeforces.com/contest/59/submission/89574201
*/
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
void test_case()
{
string s;
cin >> s;
auto i = [&s]()
{
unsigned j = 0;
for (auto x : s) if (toupper(x) == x) ++j;
return j;
};
if(i() > s.length() / 2)
{
transform(s.begin(), s.end(), s.begin(),
[](unsigned char c)
{
return toupper(c);
});
}
else
{
transform(s.begin(), s.end(), s.begin(),
[](unsigned char c)
{
return tolower(c);
});
}
cout << s;
}
int main()
{
test_case();
return 0;
}