From 7c3f32fab3b1a9d628d6856e7a923eb3c3b1ce5f Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Sat, 25 Jun 2022 18:32:00 +0200 Subject: Solved a couple of problems from codechef and codeforces --- Word/inp | 0 Word/main | Bin 0 -> 24328 bytes Word/main.cpp | 34 ++++++++++++++++++++++++++++++++++ Word/main_input0.txt | 1 + Word/main_input1.txt | 1 + Word/main_input2.txt | 1 + Word/main_output0.txt | 1 + Word/main_output1.txt | 1 + Word/main_output2.txt | 1 + 9 files changed, 40 insertions(+) create mode 100644 Word/inp create mode 100755 Word/main create mode 100644 Word/main.cpp create mode 100644 Word/main_input0.txt create mode 100644 Word/main_input1.txt create mode 100644 Word/main_input2.txt create mode 100644 Word/main_output0.txt create mode 100644 Word/main_output1.txt create mode 100644 Word/main_output2.txt (limited to 'Word') diff --git a/Word/inp b/Word/inp new file mode 100644 index 0000000..e69de29 diff --git a/Word/main b/Word/main new file mode 100755 index 0000000..01dfeb5 Binary files /dev/null and b/Word/main differ diff --git a/Word/main.cpp b/Word/main.cpp new file mode 100644 index 0000000..31937b2 --- /dev/null +++ b/Word/main.cpp @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + +string convertLower(string s) { + for(auto &ch : s) { + ch = tolower(ch); + } + return s; +} +string convertUpper(string s) { + for(auto &ch : s) { + ch = toupper(ch); + } + return s; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + int l = 0; + int u = 0; + for(auto ch : s) { + if(islower(ch)) { + l++; + } else { + u++; + } + } + cout << (l < u ? convertUpper(s) : convertLower(s)); +} diff --git a/Word/main_input0.txt b/Word/main_input0.txt new file mode 100644 index 0000000..dcf8e7c --- /dev/null +++ b/Word/main_input0.txt @@ -0,0 +1 @@ +HoUse diff --git a/Word/main_input1.txt b/Word/main_input1.txt new file mode 100644 index 0000000..619b51b --- /dev/null +++ b/Word/main_input1.txt @@ -0,0 +1 @@ +ViP diff --git a/Word/main_input2.txt b/Word/main_input2.txt new file mode 100644 index 0000000..b6751f3 --- /dev/null +++ b/Word/main_input2.txt @@ -0,0 +1 @@ +maTRIx diff --git a/Word/main_output0.txt b/Word/main_output0.txt new file mode 100644 index 0000000..90dde25 --- /dev/null +++ b/Word/main_output0.txt @@ -0,0 +1 @@ +house diff --git a/Word/main_output1.txt b/Word/main_output1.txt new file mode 100644 index 0000000..7077ce5 --- /dev/null +++ b/Word/main_output1.txt @@ -0,0 +1 @@ +VIP diff --git a/Word/main_output2.txt b/Word/main_output2.txt new file mode 100644 index 0000000..f5f6bec --- /dev/null +++ b/Word/main_output2.txt @@ -0,0 +1 @@ +matrix -- cgit v1.2.3