# ROT13 and upside-down text (flip text)

When I saw this title in the Hot Network Questions I thought it was going to be a PPCG challenge. I was a little disappointed when it was on Mathematica.

So now it is on PPCG:

## Challenge

Given an input string, output the ROT13, flipped value. The input will contain characters from the following alphabet: [abcdefghijklmnopqrstuvwxyz <flipped alphabet>]1

The flipped alphabet can be anything visually similar to the flipped lowercase Latin alphabet so long as it can be accepted as input.

The space character should remain unchanged.

As an example, your flipped alphabet might be zʎxʍʌnʇsɹbdouɯlʞɾᴉɥƃɟǝpɔqɐ

## Example

Input:    caesar woz ere
Rot13:    pnrfne jbm rer
Output:   ɹǝɹ ɯqɾ ǝuɟɹud

Input:    ɹǝɹ ɯqɾ ǝuɟɹud
Rot13:    pnrfne jbm rer
Output:   caesar woz ere


## Scoring

Simple , the lowest number of bytes wins.

I think this is different enough to the proposed duplicate for a few reasons:

• The answerer has the choice of which characters to use as output (within limits)
• The process should be reversible. i.e. flipped text should be acceptable as input and return "normal" text.
• There is the opportunity for graphical solutions in this question.
• Please include a list of the flipped alphabet. – Leaky Nun Jun 8 '17 at 9:38
• related – Leaky Nun Jun 8 '17 at 9:40
• @EriktheOutgolfer, I think it's probably different enough for a few reasons. I've added my reasons to the question. – James Webster Jun 8 '17 at 10:24
• @JamesWebster Then, first of all, what are the limits? Second, what do you mean by "graphical solutions"? If the output is an image, are the solutions below supposed to take that image as input and print the original text or something? – Erik the Outgolfer Jun 8 '17 at 10:28
• Your flipped alphabet contains letters from the roman alphabet, so it's impossible to know whether d is a flipped p and should therefore rot13 to ɔ before flipping to c, rather than rot13 to q and flipping to b. – Neil Jun 8 '17 at 10:44

# Mathematica, 234 bytes

T=ToExpression;B=Characters;L=T@CharacterRange["a","z"];K=T@B@"uodbɹsʇnʌʍxʎzɐqɔpǝɟƃɥᴉɾʞlɯ";(If[Max@ToCharacterCode@#<123,A=L;F=K,A=K;F=L];S=Association@Table[ToRules[A[[Z]]==F[[Z]]],{Z,Length@L}];Row@Reverse@T@B@#/.S)&


# Python 3, 120 bytes

many bytes saved thanks to @JonathanAllan

lambda s,a='abcdefghijklmnopqrstuvwxyz VOďƄɹ5ʇη^MXʎ2ɐʠ>Pəɟ6ɥ!ɾʞ|W ':''.join(a[(a.find(c)+27)%54]for c in s)


Try it online!

• @JonathanAllan fixed (plus space issue). in case of ambiguity (like "uodb") will choose the normal alphabet to translate from – Uriel Jun 9 '17 at 3:34
• Nice fix, although the [abc... <flipped>] does suggest one alphabet and possible mixed input, maybe you can save bytes and fix both at the same time by picking some other unicode chars? – Jonathan Allan Jun 9 '17 at 3:43
• @JonathanAllan I already tested the option to use a single string (with a[(a.index(x)+27)%54], but I didn't find decent replacements for the overlapping characters. – Uriel Jun 9 '17 at 3:47
• @JonathanAllan I can't see dennis' tio links (wifi provider blocks) – Uriel Jun 9 '17 at 4:03
• Wow, why? OK lambda s,a='abcdefghijklmnopqrstuvwxyz υοďƄɹ5ʇηʌʍXʎ2ɐʠɔǷəɟɓɥ!ɾʞ|ɯ ':''.join(a[(a.find(c)+27)%54]for c in s) – Jonathan Allan Jun 9 '17 at 4:05