def collapse_states(states):
    """
    Given a list of light states, collapse any adjacent entries that have the
    same state.

    If there are no adjacent matching states, there is no change to the output

    >>> collapse_states([('R',1), ('Y', 1), ('R', 1)])
    [('R', 1), ('Y', 1), ('R', 1)]

    Adjacent states are collapsed, summing their durations

    >>> collapse_states([('R',1), ('R', 1), ('Y', 1)])
    [('R', 2), ('Y', 1)]

    >>> collapse_states([('R',1), ('R', 2), ('R', 3), ('Y', 1)])
    [('R', 6), ('Y', 1)]
    """
    new_states = states[:1]

    for state in states[1:]:
        last_state = new_states[-1]
        if state[0] == last_state[0]:
            new_states[-1] = (state[0], last_state[1] + state[1])
        else:
            new_states.append(state)
    return new_states