eolymp
bolt
Try our new interface for solving problems
Problems

Sequence Formatting

Sequence Formatting

Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example, number sequence written like "\textbf{1,2 ,3,..., 10}" will be corrected to "\textbf{1, 2, 3, ..., 10}". In this task you are given a string \textbf{s}, which is composed by a concatination of terms, each of which may be: \begin{itemize} \item a positive integer of an arbitrary length (leading zeroes are not allowed), \item a "comma" symbol ("\textbf{,}"), \item a "space" symbol (" "), \item "three dots" ("...", that is, exactly three points written one after another, also known as suspension points). \end{itemize} Polycarp wants to add and remove spaces in the string \textbf{s} to ensure the following: \begin{itemize} \item each comma is followed by exactly one space (if the comma is the last character in the string, this rule does not apply to it), \item each "three dots" term is preceded by exactly one space (if the dots are at the beginning of the string, this rule does not apply to the term), \item if two consecutive numbers were separated by spaces only (one or more), then exactly one of them should be left, \item there should not be other spaces. \end{itemize} Automate Polycarp's work and write a program that will process the given string \textbf{s}. \InputFile The input data contains a single string \textbf{s}. Its length is from \textbf{1} to \textbf{255} characters. The string \textbf{s} does not begin and end with a space. Its content matches the description given above. \OutputFile Print the string \textbf{s} after it is processed. Your program's output should be \textit{exactly} the same as the expected answer. It is permissible to end output line with a line-break character.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1,2 ,3,...,     10
Output example #1
1, 2, 3, ..., 10