Swap the last character of a string by In this program, we will take a string as input and swap the last character of a string Steps to solve the program Take a string as input.Swap the last character of a string using Indexing.Print the output. Output : Previous replace the second occurrence of any char with the special character $. Next exchange the first and last character of each word