#C631. Reverse Each Word Preserving Punctuation

    ID: 50056 Type: Default 1000ms 256MiB

Reverse Each Word Preserving Punctuation

Reverse Each Word Preserving Punctuation

Your task is to implement a program that processes a given sentence and reverses each word individually while preserving the original order of words and all punctuation. A word is defined as a sequence of alphanumeric characters (including underscores). The program should read input from stdin and output the transformed sentence to stdout.

For example, given the input "Hello, World!", the output should be "olleH, dlroW!" because each word ("Hello" and "World") is reversed on its own while commas, exclamation marks, and spacing remain in place.

Note: The reversal is done strictly at the character level within each word. All non-word characters (such as punctuation and spaces) must be preserved exactly in their original positions.

inputFormat

The input consists of a single string provided through stdin. The string may contain letters, digits, punctuation marks, spaces, and newlines.

outputFormat

The output should be the modified string, printed to stdout, where every word in the original input has been reversed at the character level while the order of words and any punctuation remains unchanged.

## sample
Hello, World!
olleH, dlroW!