# This stores names in a list, with each name appearing only once.
# The first time a name appears it is appended to the list.  The
# second time a message says the name is already in the list.  If
# the name is given more than twice the message is "Stop it!"

# Each entry of the list now has the form [name, count], where the
# second field of the entry says how many times this name has been given.

def AddToList(L, name):
    # This first checks the list to see if the name already exists;
    # if the name is not found it is appended to the list.
    # If the name is found the message printed depends upon  how often
    # the name has been given, which is the [1] field of the entry.
    for entry in L:
        if entry[0] == name:
            if entry[1] == 1:
                print "That person is already in the list."
            else:
                print "Stop it!"
            entry[1] += 1
            return
    else:
        L.append([name, 1])

def BuildList(L):
    # This loops around asking for names and calls function AddToList to
    # insert them into the list.
    done = False
    while not done:
        name = raw_input( "Enter a name or blank to exit: " )
        if name == "":
            done = True
        else:
            AddToList(L, name )

def PrintList( L ):
    # This just prints the names in the list.  In each entry the [0] field
    # is the name itself.
    for entry in L:
        print entry[0]

def main():
    namelist = []
    BuildList(namelist)
    PrintList(namelist)

main()
