Example 78: Reverse a String
Learn how to reverse a string.
We'll cover the following
Problem
Write a function that takes in a string as input and reverses it. It should also print the reversed string on the console.
Example
Input | Output |
---|---|
To err is human | namuh si rre oT |
But to really mess things up | pu sgniht ssem yllaer ot tuB |
One needs to know C | C wonk ot sdeen enO |
Try it yourself
Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.
Get hands-on with 1400+ tech skills courses.