def AA2n(s):
    """
    >>> AA2n('AA')
    27
    >>> AA2n('A')
    1
    >>> AA2n('BC')
    55
    """
    v = 0
    for i in s:
        v *= 26
        n = ord(i) - ord('A')
        n += 1
        v += n
    return v