def base2int(inp: str, alphabet: str) -> int:
    """\
    Convert an string representation to its integer in a given base(length of alphabet)

    :param inp: input string to conversion
    :param alphabet: alphabet to conversion
    :return:
    """

    assert isinstance(inp, str), "`input` must be `str`!"
    assert isinstance(alphabet, str), "`alphabet` must be `str`!"
    assert len(alphabet) > 1, "`alphabet` length must be > 1!"

    pwr = len(inp) - 1
    out = 0
    b = len(alphabet)
    for c in inp:
        if c not in alphabet:
            raise ValueError("`input` out of alphabet")
        out += b ** pwr * alphabet.index(c)
        pwr -= 1
    return out