Find the last occurrence of a character in a string