#C11966. Clean Feedback Strings
Clean Feedback Strings
Clean Feedback Strings
You are given a string s that consists of words separated by spaces. Each word may end with one or more punctuation characters from the set \( \{.,!?,\} \). Your task is to remove any trailing punctuation marks from each word and output the cleaned string.
Note: Only the trailing punctuation of each word should be removed. For example, if a word is "hello!", it should become "hello".
Example:
Input: hello! there. how's, everyone? Output: hello there how's everyone
The problem is straightforward and can be solved by iterating through each word and removing the punctuation characters (\(.,!?\)) at the end.
inputFormat
The input consists of a single line that contains a string s, where words are separated by spaces.
outputFormat
Output the cleaned string where punctuation marks .
, ,
, !
, and ?
have been removed from the end of each word.
this is a test
this is a test