Algorithm · Square · Easy
You are given a string made up of words separated by spaces, possibly with punctuation mixed in. Transform every word in it: take the word's leading character, relocate it to the back of the word, and then attach a predetermined suffix after it. Only the words themselves change. Every space and every punctuation mark must remain exactly where it appeared in the input string, so the overall layout of the text is preserved while each word is rewritten in place. Return the…