def toMorse(text):
    global chars
    global morseCode
    text = text.replace(' ', '/ ')
    text = list(text)
    for char in range(len(text)):
        if ((text[char] != '/') and (text[char] != ' ')):
            index = chars.index(text[char])
            text[char] = morseCode[index]
            if (char != (len(text) - 1)):
                text[char] += ' '
    text = ''.join(text)
    return text
def toMorse(text):
    global chars
    global morseCode
    text = text.replace(' ', '/ ')
    text = list(text)
    for char in range(len(text)):
        if ((text[char] != '/') and (text[char] != ' ')):
            index = chars.index(text[char])
            text[char] = morseCode[index]
            if (char != (len(text) - 1)):
                text[char] += ' '
    text = .join(text)
    return text