Problem F

Statement
Copy Copied
Description:
In this problem you are given a string s consisting of uppercase and lowercase Latin letters, spaces, dots and commas. Your task is to correct the formatting of this string by removing and inserting spaces, as well as changing the case of the letters.

After formatting, the resulting string must meet the following requirements:

- the string must not start with a space;
- there should be exactly one space between any two consecutive words;
- there should be a Latin letter immediately before a dot or a comma, and there should be a space immediately after a dot or a comma in the case that there is a word after that dot or comma, otherwise that dot or comma must be the last character in the string;
- all letters must be lowercase, except all first letters in the first words of the sentences, they must be capitalized. The first word of a sentence is a word that is either the first word of the string or a word after a dot.

It is guaranteed that there is at least one letter in the given string between any two punctuation marks (commas and dots are punctuation marks). There is at least one letter before the leftmost punctuation mark.

Input Format:
The first line contains a non-empty string s, consisting of uppercase and lowercase Latin letters, spaces, dots and commas. The length of the given string does not exceed 255. The string is guaranteed to have at least one character other than the space.

Output Format:
Output the corrected string which meets all the requirements described in the statement.

Note:
None

Submissions

IDLanguageExit CodeTimestampCodeStdoutStderrRetry
5735 go 0 2026-03-20T04:15:47.097459Z View View View Retry
5690 go 1 2026-03-20T04:03:38.933161Z View View View Retry

Evaluations

Eval IDRun IDProviderModelLangSuccessTimestampPromptResponseStdoutStderrRetry
3025 20260319-220008 openai gpt-5.4 go false 2026-03-19T22:19:01.274951Z View View View View Retry