import time


def parse_long_dates(date_string):
    """Extracts three simple strings representing the year, month, and day
    from a date in the  in the long format like 'November 19, 2010'.

    Args:
        date_string (str): The date in 'long' format
    Returns:
        year (str): The year as a four-character string
        month (str): The month as a string representing an integer between 1 and 12
        day (str): The day as a string representing an integer between 1 and 31
    """
    # check for garbage at the end of the string
    while not date_string[-1].isnumeric():
        date_string = date_string[:-1]
    # grab the front of the string, where we expect the three-letter month to be
    month = date_string[:3]
    # this error will come up, so we catch it
    if month == "une":
        month = "Jun"
    # grab the back of the string to get the year
    year = date_string[-4:]
    # try to convert the month to str(int) form, or throw an error
    try:
        month = str(time.strptime(month, "%b").tm_mon)
    except ValueError as err:
        print(f"month: {month}")
        print(f"Encountered ValueError on file: {date_string}")
    day = date_string.split(" ")[1]
    day = "".join(filter(str.isdigit, day))
    # check integrity
    assert (
        year.isnumeric()
    ), f"The year is not numeric. year: {year} input: {date_string}"
    assert (
        month.isnumeric()
    ), f"The month is not numeric. month: {month} input: {date_string}"
    assert day.isnumeric(), f"The day is not numeric. day: {day} input: {date_string}"
    return year, month, day