Swap the last character of a string

In this program, we will take a string as input and swap the last character of a string

Steps to solve the program
  1. Take a string as input.
  2. Swap the last character of a string using Indexing.
  3. Print the output.

Output :

replace the second occurrence of any char with the special character $.

exchange the first and last character of each word

Leave a Comment