def string_width(string : str) -> int:
    """
    Calculate the width of a string after its last newline
    """
    found_newline = False
    width = 0
    for c in reversed(string):
        if c == '\n' and found_newline:
            break
        if c == '\n':
            found_newline = True
            continue
        if found_newline:
            width += 1
    return width