'''
Created on Nov 6, 2014

@author: medowd
'''

def emailsLargest(courses):
    
    # 1. .split(":")
    listall = [x.split(":") for x in courses]
    
    # 2. create a dictionary (course names and emails as keys and values)
    coursemap = {}
    for item in listall:
        if item[0] in coursemap:
            coursemap[item[0]].append(item[2])
        else:
            coursemap[item[0]] = [item[2]]
    
    # 3. find the max number of students per course
    # 4. find all of the courses with max number of students
    # 5. take first of those courses sorted alphabetically
    # 6. get the emails of people in that course using our dictionary
    # 7. sort and join the emails
