You are asked to write a simple cypher that rotates every character (in range [a-zA-Z], special chars will be ignored by the cipher) by 13 chars. As an addition to the original ROT13 cipher, this cypher will also cypher numerical digits ([0-9]) with 5 chars.

Example:

    "The quick brown fox jumps over the 2 lazy dogs"

will be cyphered to:

    "Gur dhvpx oebja sbk whzcf bire gur 7 ynml qbtf"

Your task is to write a ROT13.5 (ROT135) method that accepts a string and encrypts it.
Decrypting is performed by using the same method, but by passing the encrypted string again.

Note: when an empty string is passed, the result is also empty.

When passing your succesful algorithm, some random tests will also be applied. Have fun!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def ROT135(input):
	

Solutions:
trans = 'abcdefghijklmnopqrstuvwxyz' * 2
trans += trans.upper() + '0123456789' * 2

def ROT135(input):
	output = []
	for c in input:
		if c.isalpha():
			c = trans[trans.index(c) + 13]
		elif c.isdigit():
			c = trans[trans.index(c) + 5]
		output.append(c)
	return ''.join(output)


table = str.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm5678901234')

def ROT135(input):
	return input.translate(table)


from string import ascii_lowercase as low, ascii_uppercase as upp, digits as dig
trans = str.maketrans(low + upp + dig, low[13:] + low[:13] + upp[13:] + upp[:13] + dig[5:] + dig[:5])

def ROT135(input):
	return input.translate(trans)


from string import digits as d, ascii_lowercase as l, ascii_uppercase as u
tbl = str.maketrans(d + l + u, d[5:] + d[:5] + l[13:] + l[:13] + u[13:] + u[:13])

def ROT135(input):
	return input.translate(tbl)


from string import ascii_lowercase as lowers, digits
rotlow = f'{lowers[13:]}{lowers[:13]}'
rotdig = f'{digits[5:]}{digits[:5]}'
table = str.maketrans(f'{lowers}{lowers.upper()}{digits}', f'{rotlow}{rotlow.upper()}{rotdig}')

def ROT135(input):
	return input.translate(table)


def ROT135(message):
	first = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
	trance = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm5678901234'
	return message.translate(str.maketrans(first, trance))


t = 'abcdefghijklmnopqrstuvwxyz' * 2
t += t.upper() + '0123456789zzz5678901234'

def ROT135(input):
	return ''.join((t[t.index(c) + 13] if c in t else c for c in input))


D = {a: b for (a, b) in zip('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM5678901234')}

def ROT135(s):
	return ''.join((D.get(c, c) for c in s))