Just because the reverse and palindrome were not too challenging individually :)
Write a program (full program or function) that satisfies the following: given a string input,
- the program as-is outputs the input string unchanged.
- the program reversed outputs the input string reversed.
- the program palindromized outputs the input string palindromized.
- the program reversed and then palindromized outputs the input string reversed and then palindromized.
In this challenge, palindromize is defined as "concatenate the reverse on the right" (lambda s: s + s[::-1]
in Python).
For example, if your code is abc
, when given "xyz"
as input,
abc
should output"xyz"
.cba
should output"zyx"
.abccba
should output"xyzzyx"
.cbaabc
should output"zyxxyz"
.
You may assume that the input string is nonempty and entirely consists of printable ASCII (32-126, no newlines).
Standard code-golf rules apply. The shortest code in bytes wins.