The function replaces the last character of a string with a different character. If the last character is a letter, it replaces it with the next character in the alphabet. If the last character is a number or a special character, it remains unchanged.

