Skip to content

Commit

Permalink
ABC357B Uppercase and Lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicfred committed Jun 10, 2024
1 parent a9b1bbf commit 3e15e87
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions atcoder/abc357b_uppercase_and_lowercase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Vicfred
// https://atcoder.jp/contests/abc357/tasks/abc357_b
// implementation
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main () {
string S;
cin >> S;
int upper, lower;
upper = lower = 0;
for(int i = 0; i < S.size(); ++i) {
if((S[i] - 'A') < 32) {
upper++;
} else {
lower++;
}
}
if(upper > lower) {
for(int i = 0; i < S.size(); ++i) {
cout << (char)toupper(S[i]);
}
} else {
for(int i = 0; i < S.size(); ++i) {
cout << (char)tolower(S[i]);
}
}
cout << endl;
return 0;
}

0 comments on commit 3e15e87

Please sign in to comment.