Simulate the behaviour of the queues of the supermarket of an army headquarter. Initially, there are n queues (1, 2, …, n), each one with its customers. Afterwards, two things can happen:
Input
The input starts with the number of queues n (a natural strictly positive). n lines follow, one per line, each one with its customers (a word) and their graduations ("soldier", "sergeant", "captain", or "colonel"), in the order that they have arrived to que queue. After a line in white comes and a series of events, one per line: the word "ENTER" followed by the customer, the graduation, and the queue which he arrives to, or the word "LEAVE" followed by the queue which he leaves.
Output
First, your program must print the name of the customers that leave the queues, in the order that they left. After, it must print the final content of the n queues, each one from the beginning to the end. Follow the format of the instance.
Hint: Use the instructions getline(cin, st) (where st is a string) to read a line, and istringstream iss(st); to create a stream iss which you can read the names and graduations from, iss >> nam >> gra;, where nam and gra also are strings. Be careful with the first getline you do, that will correspond to the line where the number n is.
Autor: Salvador Roura
Input
4 Cristina soldier Tomas captain Francesc sergeant Damia soldier Domenec colonel Teresa captain Toni sergeant Carles captain LEAVE 1 LEAVE 1 ENTER Amalia sergeant 4 ENTER Pep soldier 4 LEAVE 2 LEAVE 1 ENTER Leo captain 1 ENTER Maria sergeant 4 LEAVE 4 LEAVE 4 LEAVE 4 ENTER Carme soldier 4 LEAVE 2 LEAVE -1 LEAVE 2
Output
LEAVINGS ------- Tomas Cristina Domenec Teresa Carles Toni Francesc Damia FINAL CONTENT ------------------ queue 1: Leo queue 2: queue 3: queue 4: Amalia Maria Pep Carme