Information About Persons
The secret service of Landia decided to manage information about the whole people of Landia.
Unfortunately, its computer scientists are completely helpless. The input looks as follows.
The first line contains the number of records, n ≤ 200 000. On
the next n lines, every record stores information about one person:
-
personal code (a 31-bit positive integer);
-
status (two to seven nonspace characters); the first character is always
M
or F
(sex); if the second character is –
(minus), the person is
dead; otherwise, if one of the next characters is C
, the person is computer
scientist; if one character is S
, the person works for the secret service;
-
name of the person (8 to 35 characters, including space).
Why are the computer scientists of the secret service so helpless? The above list contains a
lot of duplicates: every time a person changes its status or name, the new record is simply
added at the end of the list.
The secret service wants to know:
-
how many men are living in Landia;
-
how many women are living in Landia;
-
how many computer scientists are working in Landia;
-
how many persons are working for the secret service;
-
the list of computer scientists who work for the secret service (in alphabetical order);
display this list after one empty line.
Beware: consider only the last (actual) status of every person.
Sample Input
12
10 FAB Blue Mary
15 MCA Sonk Jean
10 FAS Rode Mary
20 FXS Aske Vera
20 F- Aske Vera
12 FDE Kant Mia
12 FSE Kant Mia
16 MUV Barbe Louis
21 MSC Conta Pietro
24 FCS Ando Maria
16 MCS Barbe Louis
25 FET Donk Laura
download as text file
Output for Sample Input
3 men
4 women
4 computer scientists
5 for secret service
24 FCS Ando Maria
16 MCS Barbe Louis
21 MSC Conta Pietro
download as text file