#K65527. Tone Down Exclamation Marks
Tone Down Exclamation Marks
Tone Down Exclamation Marks
The problem requires you to process a given message string and replace every occurrence of two or more consecutive exclamation marks with a single exclamation mark. This operation should be performed using regular expressions (regex) where applicable. The solution should read the input from standard input (stdin) and output the modified string to standard output (stdout).
In mathematical terms, for any substring matching the pattern \( !{2,} \) in the input, it should be substituted with a single "!".
Example:
Input: Hi there!!!! How are you?!! Output: Hi there! How are you?!
inputFormat
The input consists of a single string which may contain letters, punctuation and spaces. The string is provided via standard input (stdin).
Note: The string will be processed as a whole.
outputFormat
Output a single string derived from the input, wherein every instance of consecutive exclamation marks (two or more) is replaced by a single exclamation mark. Print the result to standard output (stdout).
## sampleHi there!!!! How are you?!!
Hi there! How are you?!