#C10403. Capitalize Words
Capitalize Words
Capitalize Words
Given a string s, transform it so that the first character of each word is capitalized if it is an alphanumeric character. A word is defined as a contiguous sequence of alphanumeric characters. Words are separated by one or more space characters, and the original spacing must be preserved.
For example, if s = "hello world! this is a test.", the output should be "Hello World! This Is A Test.".
Note that if a word starts with a non-alphanumeric character, it should remain unchanged.
The relation for the capitalization of an alphanumeric character c can be formulated in LaTeX as:
$$\texttt{capitalized}(c) = \begin{cases} \texttt{\uppercase}(c), & \text{if } c \in [0-9A-Za-z] \\ c, & \text{otherwise} \end{cases} $$inputFormat
The input consists of a single line containing the string s.
Note: The string may contain spaces and punctuation, and the spacing should be preserved in the output.
outputFormat
Output the transformed string where the first alphanumeric character of each word is capitalized.
## samplehello world
Hello World