Inspired by I reverse the source code, ...
Your task, if you wish to accept it, is to reverse text and mirror select characters. Yes, yes, I know. Very surprising.
Input
A string, stdin
, an array of characters, or any other source of text. All characters of the input are guaranteed to be in the printable ASCII range (32-126).
Output
The reversed text with some characters mirrored. To do this:
- You replace any occurrences of the characters
(
,)
,/
,\
,<
,>
,[
,]
,{
, or}
in the text with the corresponding "mirrored" character:)
,(
,\
,/
,>
,<
,]
,[
,}
, or{
. - and then reverse the text.
You may assume a maximum line length of 255.
Rules
- Standard loopholes apply.
- This is code-golf, which means that the shortest answer in each programming languages wins. Consequently, I will not be accepting an answer.
Testcases
(s)t/r\i<n>g[i]e{s} -> {s}e[i]g<n>i/r\t(s)
stringies -> seignirts
()/\<>[]{} -> {}[]<>/\()
{s}e[i]g<n>i/r\t(s) -> (s)t/r\i<n>g[i]e{s}
seignirts -> stringies
{}[]<>/\() -> ()/\<>[]{}
qwertyuiop database -> esabatad poiuytrewq
As seen above, the output should go back to the input if run through the program again.
(){}/\[]
with)(}{\/][
and then reverse it, so the text looks "mirrored". The title was planned to be "mirror text" but that was too short, so I had to add some filler. \$\endgroup\$