#K78797. Remove Redundant Commas

    ID: 35166 Type: Default 1000ms 256MiB

Remove Redundant Commas

Remove Redundant Commas

You are given a string message that may contain redundant commas. Your task is to remove any leading and trailing commas, and to replace any sequence of consecutive commas within the string with a single comma.

For example, if the input is ",hello,world,,", the output should be "hello,world". Please ensure that if the string contains no commas, it remains unchanged, and if the string contains only commas, the output is an empty string.

Note: The solution must read input from standard input (stdin) and write the result to standard output (stdout).

inputFormat

The input consists of a single line containing the string message. This string may contain any characters including commas.

outputFormat

Output a single line containing the cleaned message. All leading and trailing commas should be removed and any multiple consecutive commas replaced with a single comma.

## sample
,hello,world,,
hello,world