# Task
 A ciphertext alphabet is obtained from the plaintext alphabet by means of rearranging some characters. For example "bacdef...xyz" will be a simple ciphertext alphabet where a and b are rearranged.

 A substitution cipher is a method of encoding where each letter of the plaintext alphabet is replaced with the corresponding (i.e. having the same index) letter of some ciphertext alphabet.

 Given two strings, check whether it is possible to obtain them from each other using some (possibly, different) substitution ciphers.

# Example

 For `string1 = "aacb" and string2 = "aabc"`, the output should be `true`

 Any ciphertext alphabet that starts with acb... would make this transformation possible.

 For `string1 = "aa" and string2 = "bc"`, the output should be `false`

# Input/Output


 - `[input]` string `string1`

    A string consisting of lowercase characters.

    Constraints: `1 ≤ string1.length ≤ 10`.


 - `[input]` string `string2`

    A string consisting of lowercase characters of the same length as string1.

    Constraints: `string2.length = string1.length`.


 - `[output]` a boolean value

Source: codewars | Difficulty: EASY

Starter code: def is_substitution_cipher(s1, s2):
	

Solutions:
def is_substitution_cipher(s1, s2):
	return len(set(s1)) == len(set(s2)) == len(set(zip(s1, s2)))


def f(s1, s2):
	d = {}
	for (a, b) in zip(s1, s2):
		if a in d and d[a] != b:
			return False
		d[a] = b
	return True

def is_substitution_cipher(s1, s2):
	return f(s1, s2) and f(s2, s1)


def is_substitution_cipher(s1, s2):
	translation = {}
	back_translation = {}
	for (ch1, ch2) in zip(s1, s2):
		if ch1 in translation:
			if not translation[ch1] == ch2:
				return False
		else:
			translation[ch1] = ch2
		if ch2 in back_translation:
			if not back_translation[ch2] == ch1:
				return False
		else:
			back_translation[ch2] = ch1
	return True


def is_substitution_cipher(s1, s2):
	return len(set(s1)) == len(set(s2)) == len(set(((a, b) for (a, b) in zip(s1, s2))))


def is_substitution_cipher(s1, s2):
	(plain, cipher) = ({}, {})
	for (a, b) in zip(s1, s2):
		if plain.setdefault(a, b) != b or cipher.setdefault(b, a) != a:
			return False
	return True


def is_substitution_cipher(s1, s2):
	dict1 = {}
	dict2 = {}
	for (i, j) in zip(s1, s2):
		dict1[i] = dict1.get(i, 0) + 1
		dict2[j] = dict2.get(j, 0) + 1
		if len(dict1) != len(dict2):
			return False
	return True


def is_substitution_cipher(s1, s2):
	return s2 == s1.translate(str.maketrans(s1, s2)) and s1 == s2.translate(str.maketrans(s2, s1))


def is_substitution_cipher(a, b):
	(d1, d2) = ({}, {})
	for (x, y) in zip(a, b):
		if x in d1 and d1[x] != y or (y in d2 and d2[y] != x):
			return 0
		d1[x] = y
		d2[y] = x
	return 1