"""
Full name: Stefan Guettel
StudentId: 123456
Email: stefan.guettel@manchester.ac.uk
"""

def digitval(n):
    """
    Returns the value of the largest digit in the integer `n` provided.
    """
    n = abs(n)
    md = 0
    while n:
        md = max(n % 10, md)
        n = n // 10
    return md

def digitpos(n):
    """
    Returns the position of the first occurence of the largest digit in 
    the integer `n` provided, with the position counted from left to right.
    """
    n = abs(n)
    md = 0
    mi = 0
    i = 1
    while n:
        d = n % 10
        if d >= md:
            mi = i
            md = d
        n = n // 10
        i = i + 1
    return i - mi


def main():
    # We're just testing our functions here
    print("digitval(-273):", digitval(-273))
    print("digitval(-273):", digitpos(1767234))
    return

main()