Word
Practice this coding question on Coding Gurukul.
Problem statement
A newsletter editor receives a word that mixes uppercase and lowercase letters. The editor wants a visually consistent version, but also wants to change as few individual characters as possible. The house style resolves a tie in favour of lowercase. You are implementing this single-word cleanup before the newsletter is assembled; spelling and character order must stay the same. Your task Count the uppercase and lowercase English letters in the word. If uppercase letters are strictly more numerous, convert every letter to uppercase. Otherwise convert every letter to lowercase. Print the resulting word with exactly the same number of characters. Important details An equal number of uppercase and lowercase characters must produce an all-lowercase result. A word already written entirely in one case needs no changes. Count cases before converting. Worked example In CoDE, three letters are uppercase and one is lowercase. The uppercase majority makes the final label CODE.
Input format
One word s.
Output format
Print the consistently cased word.
Constraints
1 <= length of s <= 100; English letters only.
Sample input
CoDE
Sample output
CODE
Sign in to run or submit a solution in C++, Java or Python.