- Input the string from the user.
- Find the length of the string. The actual length of the string is one less than the number of characters in the string. …
- Repeat the below steps from i = 0 to the entire length of the string.
- rev[i] = str[j]
- Print the reversed string.
sandhyamini Answered question December 16, 2023
Strings can be reversed using slicing. To reverse a string, we simply create a slice that starts with the length of the string, and ends at index 0. The slice statement means start at string length, end at position 0, move with the step -1 (or one step backward).
Sandhya Answered question September 7, 2023
