#P16194. [ROIR 2014 Day 1] Schools 学校

    ID: 18121 远端评测题 2000ms 256MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>2014Special JudgeROIR(俄罗斯)

[ROIR 2014 Day 1] Schools 学校

Problem Description

When registering for the Internet Olympiad, all participants fill in an application form, which requires them to write the name of their school. Different participants may write the school name in different ways, such as “Physics and Mathematics School No. 1818”, “Phys-Math School No. 1818”, and so on.

The organizers have already collected all the school names filled in by the participants. It is known that the digits in a school name appear only in the school number, and the digits appear exactly once in the school name. This number uniquely determines the school’s ID.

The school ID is a positive integer and does not start with zero.

Please write a program for the Olympiad website to help the organizers count the following information: how many schools have at most five participants, and output the IDs of these schools.

Input Format

The first line contains an integer n (1≤n≤1000)n\ (1 \le n \le 1000), representing the number of school names filled in by all participants.

Each of the next nn lines contains one school name. A school name contains only uppercase and lowercase English letters, digits, and spaces, and its length does not exceed 100100 characters.

Output Format

Output an integer mm in the first line, representing the number of schools whose number of participants is between 11 and 55 (inclusive). Then output mm lines, each containing one qualifying school ID, in any order.

9
Physics and Mathematics School 18
9ya shkola imeni Pushkina
Lyceum 9
PaMS 18
Gymnasium 42
School 9
Shkola nomer 9
High school 9
School N 9

2
42
18

Hint

In the example, students from three schools registered for the Internet Olympiad: school ID 1818 has two students, ID 4242 has one student, and ID 99 has six students. Therefore, the school IDs whose number of participants is between 11 and 55 are 1818 and 4242.

Scoring

For the testdata worth 3030 points, each school ID is a single digit.

For the testdata worth 5050 points, each school ID is strictly less than 10001000.

For the testdata worth 8080 points, each school ID is strictly less than 10910^9.

Translation source: GPT 4.1 mini.

Translated by ChatGPT 5