def swap_diff(start, goal, limit):
    """A diff function for autocorrect that determines how many letters
    in START need to be substituted to create GOAL, then adds the difference in
    their lengths.
    >>> swap_diff("car", "cad")
    1
    >>> swap_diff("this", "that")
    2
    >>> swap_diff("one", "two")
    3
    >>> swap_diff("from", "form")
    2
    >>> swap_diff("awe", "awesome")
    4
    >>> swap_diff("someawe", "awesome")
    6
    >>> swap_diff("awful", "awesome")
    5
    """
    # BEGIN PROBLEM 6
    if limit < 0:
        return float('inf')
    elif len(start) == 0 or len(goal) == 0:
        return abs(len(goal) - len(start))
    elif start[0] != goal[0]:
        return 1 + swap_diff(start[1:], goal[1:], limit - 1)
    else:
        return swap_diff(start[1:], goal[1:], limit)
    # END PROBLEM 6