def count_sig_figs(digits: str) -> int:
    """
    Return the number of significant figures of the input digit string.
    Taken from https://codereview.stackexchange.com/questions/122284/counting-significant-figures-in-a-number
    :param digits:
    :return:
    """

    integral, _, fractional = digits.partition(".")

    if fractional:
        return len((integral + fractional).lstrip('0'))
    else:
        return len(integral.strip('0'))