I have a string: dog dog dog i want to replace just the last of dog to dog dog cat how would i do this? thanks ...