from string import ascii_lowercase


def alphabeticalToDecimal(alpha):
    """
    Converts str to an int index. e.g.: 'a' -> 0, 'b' -> 1, 'c' -> 2, 440414 -> 'yama'
    :param alpha: str
    :return: int
    """
    assert isinstance(alpha, str) and alpha
    index = -1
    steps = [(x, y) for x, y in enumerate(alpha[::-1])]
    for step, letter in steps[::-1]:
        letter_index = ascii_lowercase.index(letter)
        index += (letter_index+1)*(26**step)
    return index