Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

75%
+4 −0
Challenges Encode with ROT13.5

Given a string, convert all of its letters using ROT13, and all of its digits using ROT5. This is sometimes referred to as ROT13.5. Input A sequence of printable ASCII characters (character cod...

4 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by Razetime‭

#1: Initial revision by user avatar trichoplax‭ · 2022-11-12T13:23:36Z (almost 2 years ago)
Encode with ROT13.5
Given a string, convert all of its letters using ROT13, and all of its digits using ROT5. This is sometimes referred to as [ROT13.5](https://en.wikipedia.org/wiki/ROT13#Variants "Variants of ROT13 on Wikipedia").

## Input
- A sequence of printable ASCII characters (character codes 32 to 126 inclusive)
- This may be a string or any data structure of characters

## Output
- A sequence of characters
- This may be a string or any ordered data structure of characters. It does not need to match the input format (provided it is consistent between inputs)
  - For example, you may take input as an array of characters, and output as a string, provided this format does not change for different inputs
- Each character in the output will be determined by the character in the corresponding position in the input, as follows:
  - A lower case letter will be replaced with the lower case letter 13 character codes after it, wrapping back to 'a' if 'z' is exceeded
  - An upper case letter will be replaced with the upper case letter 13 character codes after it, wrapping back to 'A' if 'Z' is exceeded
  - A numeric digit will be replaced with the numeric digit 5 character codes after it, wrapping back to '0' if '9' is exceeded
  - Any other character will remain unchanged

## Conversion table
Here is the output character for every valid input character, in the format `input : output` (the first character is a space, which remains unchanged):

```text
  :  
! : !
" : "
# : #
$ : $
% : %
& : &
' : '
( : (
) : )
* : *
+ : +
, : ,
- : -
. : .
/ : /
0 : 5
1 : 6
2 : 7
3 : 8
4 : 9
5 : 0
6 : 1
7 : 2
8 : 3
9 : 4
: : :
; : ;
< : <
= : =
> : >
? : ?
@ : @
A : N
B : O
C : P
D : Q
E : R
F : S
G : T
H : U
I : V
J : W
K : X
L : Y
M : Z
N : A
O : B
P : C
Q : D
R : E
S : F
T : G
U : H
V : I
W : J
X : K
Y : L
Z : M
[ : [
\ : \
] : ]
^ : ^
_ : _
` : `
a : n
b : o
c : p
d : q
e : r
f : s
g : t
h : u
i : v
j : w
k : x
l : y
m : z
n : a
o : b
p : c
q : d
r : e
s : f
t : g
u : h
v : i
w : j
x : k
y : l
z : m
{ : {
| : |
} : }
~ : ~
```

## Test cases
Test cases are in the format `"input string" : "output string"`.

```text
"gnat irk terra" : "tang vex green"
"2468" : "7913"
"#%&@,.:;?" : "#%&@,.:;?"
"Rot13.5 & Ebg68.0" : "Ebg68.0 & Rot13.5"
```

> Explanations are optional, but I'm more likely to upvote answers that have one.