def transliterate(line, trans_dict):
    """
    Core function for transliteration of one line, one word at time

    :param line: source string line for transliteration
    :param trans_dict: transliteration instructions via 4 dictionaries
    :return: transliterated string
    """

    words = line.split()
    new_words = []
    for word in words:
        for key, value in trans_dict["Double"].items():
            word = word.replace(key, value)
        letters = list(word)
        new_word = ''

        for letter in letters:
            new_word += trans_dict["Single"].get(letter, letter)

        for key, value in trans_dict["Partial"].items():
            new_word = new_word.replace(key, value)

        new_word = trans_dict["Replace"].get(new_word, new_word)

        new_words.append(new_word)

    return " ".join(new_words)