import re


def extract_final_question(full_text: str) -> str:

    # Find all substrings that end with a '?' using a capturing group for the text leading up to it.
    # Each match in question_sentences will include the trailing '?' as well.
    question_sentences = re.findall(r'([^.?!]*\?)', full_text)

    if not question_sentences:
        # If there's no question mark at all, just return everything
        return full_text.strip()
    else:
        # The last match is the final question-sentence (including '?')
        last_question = question_sentences[-1].strip()
        return last_question

question = "Jared is trying to increase his typing speed. He starts with 47 words per minute (WPM). After some lessons the next time he tests his typing speed it has increased to 52 WPM. If he continues to increase his typing speed once more by 5 words, what will be the average of the three measurements?"

final_question = extract_final_question(question)
print(final_question)
