def shorten_string(input_string: str, length: int) -> str:
    """Shorten a string in a nice way:

    >>> shorten_string("foobar", 5)
    'fo...'
    """
    if len(input_string) < length:
        return input_string
    if length > 3:
        return input_string[: length - 3] + "..."
    if length == 3:
        return input_string[0] + ".."
    if length == 2:
        return input_string[0] + "."
    if length == 1:
        return input_string[0]
    return ""