Reverse a string

From Rosetta Code
Revision as of 20:53, 18 April 2008 by 146.201.224.238 (talk) (Easy!)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Reverse a string
You are encouraged to solve this task according to the task description, using any language you may know.

Take a string and reverse it. For example, "asdf" becomes "fdsa".

Python

Optimized for user input

raw_input()[::-1]

Already known string

string[::-1]