P27005 [AtCoder] Classifier-tan
普及-
题目描述

Problem Description

Classifier-tan loves converting spaces into comma-separated values. However, when consecutive spaces occur, she wants to write them as a single comma.

Given a string, output the string with spaces converted into comma-separated values.

The input is given from the standard input in the following format: > $ c_1c_2…c_N $

  • The input is given as a single line string.
  • The length of the input string $ N $ satisfies $1 \leq N \leq 2000$.
  • The $ i $-th character $ c_i $ is either an uppercase alphabet (A, $ … $, Z), a comma (,), or a space ().
  • The first character $ c_1 $ and the last character $ c_N $ are not spaces.

Output the string with spaces converted into comma-separated values to the standard output in one line. Multiple consecutive spaces should be converted into a single comma. A newline is required at the end of the line.

Input Format

None

Output Format

None

Sample Input and Output

Sample Input #1

X Y Z

Sample Output #1

X,Y,Z

Sample Input #2

QWERTY

Sample Output #2

QWERTY

Sample Input #3

A  B, C

Sample Output #3

A,B,,C

Notes/Hints

None

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
X Y Z
样例输出
X,Y,Z