Word Capitalization
Practice this coding question on Coding Gurukul.
Problem statement
A campus library prints a short label for every new digital collection. Contributors submit labels with inconsistent capitalization, but the librarian does not want software to rewrite their chosen spelling. The publishing rule is deliberately small: only the first character of a label may be adjusted. You are building the formatting step that runs immediately before a label is displayed. Your task Given one nonempty word made of uppercase and lowercase English letters, make its first character uppercase. Copy every remaining character exactly as it appeared in the input, including any uppercase letters in the middle. Return the formatted word; do not convert the whole word to title case or lowercase. Important details A one-letter word still needs processing. A label that already begins with an uppercase letter must remain unchanged. Character positions after the first are never edited. Worked example For cODing, the first character c becomes C. The suffix ODing is preserved, so the result is CODing.
Input format
One word s on a single line.
Output format
Print the formatted word.
Constraints
1 <= length of s <= 1000; s contains only A-Z and a-z.
Sample input
cODing
Sample output
CODing
Sign in to run or submit a solution in C++, Java or Python.