Task is to write a simulator that will keep track of photos remaining on the screen by using Java Collection Framework (JCF). No graphical user interface (GUI) is allowed. At the end of the simulation, your program is to display the photos remaining on the screen in the order from left to right. Photos in each simulation will be identified by a unique name (a string without spaces) and its width. There are three types of events in the simulation:
* Arrive: A new photo arrives from the left side of the screen and pushing other photos to the right as needed. No photo moves to the right unless it is pushed by an adjacent photo on its left. Any photo that is not entirely on the screen will disappear. No single photo will ever be wider than the given screen.
* Pick Up: A photo identified by a unique file name is to be picked up. If the photo is on the screen, it will disappear from the screen and leave a hole on the screen; otherwise, the pickup operation is ignored.
* End: End the simulation for this case and print the remaining photos on the screen.
The input file will contain data for one or more simulations. The end of the input is signaled by a line containing only a single integer -1. Each simulation will begin with the integer width of the screen, s, followed by a series of Arrive, Pick Up and End events. An Arrive event is a single line beginning with an upper case A followed by the unique photo name and an integer denoting the width of the photo, w. A Pick Up event is a single line beginning with an upper case P followed by the photo name. Finally, the End event is a line containing only a single upper case E. All items in a line are separated by a single space.