URI Online Judge | 2479

Sorting Santa's List of Children

Por Cristian J. Ambrosi, URI BR Brazil

Timelimit: 1

Santa Claus is in finishing to organize the delivery of gifts to all the children of the world because Christmas is coming again. Looking at his new lists of children who will win gifts this year he realized that the trainee elf (who had been responsable for making the lists) did not put the names in alphabetical order.

As Santa is a very organized man, he wants that every list of children have, at its end, the total number of children who were well behaved this year and the total of those who were not. Then he can compare the number of children that was behaved in this year and in previous ones.

To help the good old man, your function is to create a program that reads all the names in the list and prints the same names in alphabetical order. At the bottom of the list, you should print the total number of children who were good behaved and the ones who were not.

Entrada

The input consists of several names. The first value N (0 ≤ N ≤ 100), indicates how many names there are on the list. The next N lines have one special character that matches with the behavior of the child (+ indicates that the child was well behaved, - indicates that the child misbehaved). After the special character, follows the name of the children with 20 characteres at maximum.

Saída

For each list of children, you should print the names in alphabetical order. After print the names, you must show the total number of children that were well behaved ("Se comportaram: ") and misbehaved during the year ("Nao se comportaram: ").

Input Example Output Example

16
+ Tininha
+ Dudinha
- Carlinhos
- Marquinhos
+ Joaozinho
+ Bruninha
- Leandrinho
- Fernandinha
+ Rafinha
- Pedrinho
+ Aninha
- Tamirinha
- Gaguinho
- Zezinho
- Luquinhas
+ Julhinha

Aninha
Bruninha
Carlinhos
Dudinha
Fernandinha
Gaguinho
Joaozinho
Julhinha
Leandrinho
Luquinhas
Marquinhos
Pedrinho
Rafinha
Tamirinha
Tininha
Zezinho

Se comportaram: 7 | Nao se comportaram: 9

10
+ Zezinho
+ Mangojatinha
+ Bruninha
- Joaozinho
- Fernandinha
+ Aninha
- Luquinhas
+ Pedrinho
- Tininha
- Marquinhos

Aninha
Bruninha
Fernandinha
Joaozinho
Luquinhas
Mangojatinha
Marquinhos
Pedrinho
Tininha
Zezinho

Se comportaram: 5 | Nao se comportaram: 5

15
+ Joaozinho
- Fernandinha
+ Bruninha
+ Pedrinho
- Zezinho
+ Mangojatinha
- Marquinhos
+ Carlinhos
+ Aninha
- Luquinhas
+ Rafinha
+ Leandrinho
- Tamirinha
+ Julhinha
+ Gaguinho

Aninha
Bruninha
Carlinhos
Fernandinha
Gaguinho
Joaozinho
Julhinha
Leandrinho
Luquinhas
Mangojatinha
Marquinhos
Pedrinho
Rafinha
Tamirinha
Zezinho

Se comportaram: 10 | Nao se comportaram: 5