from typing import List


def explain_stability(*args):
    """
    Based on ~ CSC2032: Tutorial 1.4.1/2.1.1 ~ Question 4

    The user must type the definition below -- of course as
    a user you may change the definition typed out. By changing
    the string below.

    """

    a = "If an input list contains two equal elements in positions \
    i and j where i < j then in the sorted list they have to be in positions \
    i' and j'"
    q = 'Enter a short definition for sorting stability below.'

    def mark_continuous(user: List[str], actual: List[str]) -> int:
        '''
        :return: mark int, counted for each matching word
                 where exact order matters
        :param:  user   -- the user's answer
        :param:  actual -- the actual answer
        '''
        mark = 0
        for words in zip(user, actual):
            if (words[0].lower() != words[1]): return mark
            mark += 1
        return mark

    def mark_matches(user: List[str], actual: List[str]) -> int:
        """
        :return: mark counted for each matching word
        :param:  user   -- the user's answer
        :param:  actual -- the actual answer
        """
        mark = 0
        for words in zip(user, actual):
            if (words[0] == words[1]): mark += 1
        return mark

    answer = [word.lower() for word in a.split()]
    print('\nQuestion: ' + q)  # Print question
    user_inp = str(input("Answer  : ")).split()
    # Marking occurs
    print(f"<Mark_C = {mark_continuous(user_inp, answer)}/{len(answer)}>")
    print(f"<Mark_M = {mark_matches(user_inp, answer)}/{len(answer)}>")
    print(f"<Answer = {a}>\n")