added code to allow multiple special characters at the end of each word