def remove(S, rack):
    """removes only one instance of a letter in a rack"""
    if rack == []:
        return []
    if S == rack[0]:
        return rack[1:]
    return [rack[0]] + remove(S, rack[1:])