P6565 [NOI Online #3 Junior] Most Urgent Rescue.
Description
The rescue center receives many distress signals every day. After receiving a distress signal, the rescue center will analyze it and find the most urgent person to rescue.
A distress signal is a string consisting of lowercase English letters. The more times three consecutive characters in the string form `sos` in order (that is, the more substrings `sos` it contains), the more urgent the situation is.
Now please help the rescue center find the most urgent person. Note that the `sos` substrings in the string can overlap. For example, `sosos` is considered to contain $2$ occurrences of `sos`.
Input Format
Read input from standard input.
The first line contains an integer $n$, indicating the number of people asking for help.
The next $2 \times n$ lines each contain a string of lowercase English letters. Among these $2 \times n$ lines, the string on line $2 \times i - 1$ ($1 \le i \le n$) is the name of the $i$-th person, and the string on line $2 \times i$ is the distress signal of the $i$-th person.
Output Format
Write output to standard output.
There are two lines in total. The first line contains the name(s) of the most urgent person(s). If there are multiple most urgent people, output their names in the input order, separated by a space.
The second line contains an integer, indicating how many `sos` substrings are contained in the distress signal of the most urgent person.
Explanation/Hint
#### Constraints
- For $10\%$ of the testdata, $n = 1$.
- For all testdata, $1 \leq n \le 100$, the length of each name is at most $20$, and the length of each distress signal is at most $200$.
Translated by ChatGPT 5