#C4867. Sanitize User Message
Sanitize User Message
Sanitize User Message
You are given a string message
as input. Your task is to remove all characters from the string that are not allowed. The allowed characters are:
- All lowercase and uppercase English letters (a-z, A-Z)
- Digits (0-9)
- The space character ( )
- Punctuation marks:
.,!?
In other words, if a character is not one of those listed above, it should be removed from the output. For example, the apostrophe (') and symbols such as @, #, $, etc., should be removed.
Formally, if you denote the input string by message, then the output string result is given by:
\[ result = \text{Concatenation of all } c \in message \text{ such that } c \in \{a-z, A-Z, 0-9, \text{ space}, \text{'.'}, ',', '!', '?'\} \]
Make sure your program reads input from STDIN and writes the result to STDOUT.
inputFormat
The input consists of a single line containing the string message
. The string may include spaces and punctuation.
outputFormat
Output the sanitized string after removing all disallowed characters.
## sampleHello, World! How's everything going @ your side?
Hello, World! Hows everything going your side