Introduction 

The GADERYPOLUKI is a simple substitution cypher used in scouting to encrypt messages. The encryption is based on short, easy to remember key. The key is written as paired letters, which are in the cipher simple replacement.

The most frequently used key is "GA-DE-RY-PO-LU-KI".

```
 G => A
 g => a
 a => g
 A => G
 D => E
  etc.
```

The letters, which are not on the list of substitutes, stays in the encrypted text without changes.

Other keys often used by Scouts:

```
PO-LI-TY-KA-RE-NU
KA-CE-MI-NU-TO-WY
KO-NI-EC-MA-TU-RY
ZA-RE-WY-BU-HO-KI
BA-WO-LE-TY-KI-JU
RE-GU-LA-MI-NO-WY
```

Task

Your task is to help scouts to encrypt and decrypt thier messages.
Write the `Encode` and `Decode` functions. 

Input/Output

The function should have two parameters. 
The `message` input string consists of lowercase and uperrcase characters and whitespace character.
The `key` input string consists of only lowercase characters.
The substitution has to be case-sensitive. 

Example

 
 # GADERYPOLUKI collection



GADERYPOLUKI cypher vol 1


GADERYPOLUKI cypher vol 2


GADERYPOLUKI cypher vol 3 - Missing Key


GADERYPOLUKI cypher vol 4 - Missing key madness

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def encode(message, key):
	

Solutions:
def encode(str, key):
	key = key.lower() + key.upper()
	dict = {char: key[i - 1] if i % 2 else key[i + 1] for (i, char) in enumerate(key)}
	return ''.join((dict.get(char, char) for char in str))
decode = encode


def encode(message, key):
	(a, b) = (f'{key[i::2]}{key[i::2].upper()}' for i in (0, 1))
	return message.translate(str.maketrans(f'{a}{b}', f'{b}{a}'))
decode = encode


def encode(str, key):
	return ende(str, key)

def decode(str, key):
	return ende(str, key)

def ende(str, key):
	key += key.upper()
	rkey = ''
	for l in range(0, len(key), 2):
		rkey += key[l + 1] + key[l]
	str = list(str)
	for i in range(0, len(str)):
		if str[i] in key:
			str[i] = rkey[list(key).index(str[i])]
	return ''.join(str)


encode = decode = lambda message, key: message.translate(str.maketrans(*mapping(key)))

def mapping(key):
	(even, odd) = (key[::2] + key[::2].upper(), key[1::2] + key[1::2].upper())
	return (even + odd, odd + even)


def encode(message, key):
	tbl = str.maketrans(key[::2] + key[::2].upper() + key[1::2] + key[1::2].upper(), key[1::2] + key[1::2].upper() + key[::2] + key[::2].upper())
	return message.translate(tbl)
decode = encode


def encode(message, key):
	(s1, s2) = ([], [])
	for (c1, c2) in zip(key[0::2], key[1::2]):
		s1.append(c1 + c1.upper())
		s2.append(c2 + c2.upper())
	return message.translate(str.maketrans(*map(''.join, [s1 + s2, s2 + s1])))
decode = encode


def encode(message, key):
	(x, y) = (key[::2] + key[::2].upper(), key[1::2] + key[1::2].upper())
	return message.translate(str.maketrans(x + y, y + x))
decode = encode


def encode(s, key):
	D = {key[i]: key[i + 1] for i in range(0, len(key), 2)}
	D.update({v: k for (k, v) in D.items()})
	D.update({k.upper(): v.upper() for (k, v) in D.items()})
	return s.translate(str.maketrans(D))
decode = encode


def encode(str, key):
	switched = []
	for x in range(int(len(key) / 2)):
		switched.append(key[x * 2 + 1])
		switched.append(key[x * 2])
	switched = ''.join(switched)
	return str.translate(str.maketrans(key + key.upper(), switched + switched.upper()))

def decode(str, key):
	return encode(str, key)