String normalization - MarisaOJ: Marisa Online Judge

String normalization

Time limit: 1000 ms
Memory limit: 256 MB
Given a string $S$ consisting of letters and spaces, perform string normalization as follows: - Remove leading and trailing spaces. - Remove any extra spaces between words. - Capitalize the first letter of each word and convert the rest of the letters to lowercase. Write a program that takes as input a string and outputs the normalized string. ### Input - A single line containing the string $S$. ### Output - Print the normalized string $S$. ### Constraints - $1 \le |S| \le 1000$. ### Sample test ``` A qUick BRown fOX ``` Output: ``` A Quick Brown Fox ```