### Tongues

Gandalf's writings have long been available for study, but no one has yet figured out what language they are written in. Recently, due to programming work by a hacker known only by the code name ROT13, it has been discovered that Gandalf used nothing but a simple letter substitution scheme, and further, that it is its own inverse|the same operation scrambles the message as unscrambles it. 

This operation is performed by replacing vowels in the sequence `'a' 'i' 'y' 'e' 'o' 'u'` with the vowel three advanced, cyclicly, while preserving case (i.e., lower or upper). 

Similarly, consonants are replaced from the sequence `'b' 'k' 'x' 'z' 'n' 'h' 'd' 'c' 'w' 'g' 'p' 'v' 'j' 'q' 't' 's' 'r' 'l' 'm' 'f'` by advancing ten letters.

So for instance the phrase `'One ring to rule them all.'` translates to `'Ita dotf ni dyca nsaw ecc.'`

The fascinating thing about this transformation is that the resulting language yields pronounceable words.  For this problem, you will write code to translate Gandalf's manuscripts into plain text.

Your job is to write a function that decodes Gandalf's writings.

### Input

The function will be passed a string for the function to decode.  Each string will contain up to 100 characters, representing some text written by Gandalf. All characters will be plain ASCII, in the range space (32) to tilde (126).

### Output

For each string passed to the decode function return its translation.

Difficulty: introductory

Starter code:

def tongues(code):
	

Solutions:
def tongues(code):
    AsT = ""
    for i in code:
        if i == "i":
            AsT = AsT + "o"
        elif i == "t":
            AsT = AsT + "n"
        elif i == "a":
            AsT = AsT + "e"
        elif i == "d":
            AsT = AsT + "r"
        elif i == "f":
            AsT = AsT + "g"
        elif i == "y":
            AsT = AsT + "u"
        elif i == "c":
            AsT = AsT + "l"
        elif i == "s":
            AsT = AsT + "h"
        elif i == "w":
            AsT = AsT + "m"
        elif i == "v":
            AsT = AsT + "k"
        elif i == "q":
            AsT = AsT + "z"
        elif i == "p":
            AsT = AsT + "b"
        elif i == "j":
            AsT = AsT + "x"
        elif i == "o":
            AsT = AsT + "i"
        elif i == "n":
            AsT = AsT + "t"
        elif i == "e":
            AsT = AsT + "a"
        elif i == "r":
            AsT = AsT + "d"
        elif i == "g":
            AsT = AsT + "f"
        elif i == "u":
            AsT = AsT + "y"
        elif i == "l":
            AsT = AsT + "c"
        elif i == "h":
            AsT = AsT + "s"
        elif i == "m":
            AsT = AsT + "w"
        elif i == "k":
            AsT = AsT + "v"
        elif i == "z":
            AsT = AsT + "q"
        elif i == "b":
            AsT = AsT + "p"
        elif i == "x":
            AsT = AsT + "j"
        elif i == "I":
            AsT = AsT + "O"
        elif i == "T":
            AsT = AsT + "N"
        elif i == "A":
            AsT = AsT + "E"
        elif i == "D":
            AsT = AsT + "R"
        elif i == "F":
            AsT = AsT + "G"
        elif i == "Y":
            AsT = AsT + "U"
        elif i == "C":
            AsT = AsT + "L"
        elif i == "S":
            AsT = AsT + "H"
        elif i == "W":
            AsT = AsT + "M"
        elif i == "V":
            AsT = AsT + "K"
        elif i == "Q":
            AsT = AsT + "Z"
        elif i == "P":
            AsT = AsT + "B"
        elif i == "J":
            AsT = AsT + "X"
        elif i == "O":
            AsT = AsT + "I"
        elif i == "N":
            AsT = AsT + "T"
        elif i == "E":
            AsT = AsT + "A"
        elif i == "R":
            AsT = AsT + "D"
        elif i == "G":
            AsT = AsT + "F"
        elif i == "U":
            AsT = AsT + "Y"
        elif i == "L":
            AsT = AsT + "C"
        elif i == "H":
            AsT = AsT + "S"
        elif i == "M":
            AsT = AsT + "W"
        elif i == "K":
            AsT = AsT + "V"
        elif i == "Z":
            AsT = AsT + "Q"
        elif i == "B":
            AsT = AsT + "P"
        elif i == "X":
            AsT = AsT + "J"
        else:
            AsT = AsT + i    
    return AsT

vowels = 'aiyeou' * 2
vowels += vowels.upper()
consonants = 'bkxznhdcwgpvjqtsrlmf' * 2
consonants += consonants.upper()

def tongues(code):
    result = ""
    for c in code:
        if c in vowels:
            result += vowels[vowels.index(c) + 3]
        elif c in consonants:
            result += consonants[consonants.index(c) + 10]
        else:
            result += c
    return result

def tongues(code):
    map1 = 'aiyeoubkxznhdcwgpvjqtsrlmf'
    map2 = 'eouaiypvjqtsrlmfbkxznhdcwg'
    return code.translate(str.maketrans(map1+map1.upper(), map2+map2.upper()))

def tongues(code):
    vowels = {'a':'e', 'i':'o', 'y':'u',
              'e':'a', 'o':'i', 'u':'y'}
    consonants = {'b':'p', 'k':'v', 'x':'j', 'z':'q', 'n':'t',
                  'h':'s', 'd':'r', 'c':'l', 'w':'m', 'g':'f',
                  'p':'b', 'v':'k', 'j':'x', 'q':'z', 't':'n',
                  's':'h', 'r':'d', 'l':'c', 'm':'w', 'f':'g'}
    message = ''
    for char in code:
        Upper = False
        if char == char.upper():
            Upper = True
            char = char.lower()
        if char in vowels.keys():
            new_char = vowels[char]
        elif char in consonants.keys():
            new_char = consonants[char]
        else:
            new_char = char
        if Upper:
            new_char = new_char.upper()
        message += new_char
    return message

def tongues(code):
    return code.translate(str.maketrans('BKXZNHDCWGPVJQTSRLMFbkxznhdcwgpvjqtsrlmfAIYEOUaiyeou','PVJQTSRLMFBKXZNHDCWGpvjqtsrlmfbkxznhdcwgEOUAIYeouaiy'))
    


def tongues(code):
    vowels = ['a', 'i', 'y', 'e', 'o', 'u']
    consonants = ['b', 'k', 'x', 'z', 'n', 'h', 'd', 'c', 'w', 'g', 'p', 'v', 'j', 'q', 't', 's', 'r', 'l', 'm', 'f']
    result = ""
    for char in code:
        uppercase = True if char.isupper() else False
        if char.lower() in vowels:
            new_char = vowels[(vowels.index(char.lower()) + 3) % len(vowels)]
        elif char.lower() in consonants:
            new_char = consonants[(consonants.index(char.lower()) + 10) % len(consonants)]
        else:
            new_char = char
        result += new_char.upper() if uppercase else new_char
    return result