Consider the last character. Concatenate it to the recursive solution only if it is not a punctuation mark.