COURSES_PER_SEMESTER = 4
TOTAL_SEMESTERS = 8

def is_prefix(pre, text) :
    """
    Returns True if @pre is a prefix of @text
    
    >>> is_prefix("pre", "prefix")
    True
    >>> is_prefix("fix", "prefix")
    False
    """
    # TODO: finish function
    return True


def count_subject(subject, schedule) :
    """
    Returns the number of times @subject appears in
    the course schedule specified by @schedule.
    @subject is specified as a string
    @schedule is specified as a list of list of strings

    >>> count_subject("CSCI", [["CSCI 134", "ARTH 101"], ["CSCI 136", "STAT 201"]])
    2
    >>> count_subject("STAT", [["CSCI 134", "ARTH 101"], ["CSCI 136", "STAT 201"]])
    1
    >>> count_subject("MATH", [["CSCI 134", "ARTH 101"], ["CSCI 136", "STAT 201"]])
    0
    """
    # TODO: finish function
    count = 0
    
    for semester in schedule:
        for course in semester :
            print(subject, "?", course)

    return count

def most_popular_subject(subjects, sched) :
    """
    Returns a list of  @subject appears in
    the course schedule specified by @sched.
    @subject is specified as a string
    @sched is specified as a list of list of strings

    >>> most_popular_subject("CSCI", [["CSCI 134", "ARTH 101"], ["CSCI 136", "STAT 201"]])
    2
    >>> count_subject("STAT", [["CSCI 134", "ARTH 101"], ["CSCI 136", "STAT 201"]])
    1
    >>> count_subject("MATH", [["CSCI 134", "ARTH 101"], ["CSCI 136", "STAT 201"]])
    0
    """
    # TODO: finish function
    return []

if __name__ == "__main__":
    f05 = ["ENGL 126", "CSCI 134", "MATH 105", "PHYS 151"]
    s06 = ["LING 111", "ECON 120", "CSCI 136", "MATH 251"]
    f06 = ["ARTH 101", "ECON 110", "PSYC 101", "CSCI 237"]
    s07 = ["ARTH 102", "ECON 230", "CSCI 256", "STAT 201"]
    f07 = ["ECON 251", "ECON 252", "CSCI 361", "CSCI 373"]
    s08 = ["ECON 255", "CSCI 334", "CSCI 374", "MATH 211"]
    f08 = ["ECON 353", "ECON 475", "CSCI 336", "CSCI 371"]
    s09 = ["AMST 201", "ECON 385", "CSCI 356", "CSCI 432"]
    sched = [f05] + [s06] + [f06] + [s07] + [f07] + [s08] + [f08] + [s09]

    prefixes = ['AMST', 'ARTH', 'CSCI', 'ECON', 'ENGL', 'LING', 'MATH', 'PHYS', 'PSYC', 'STAT']

    for prefix in prefixes:
        print(prefix, count_subject(prefix, sched))
        
    print("most popular: ", most_popular_subject(prefixes, sched))

    






