TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Vasya is a system administrator of a new social network, named Five Contacts or just V Contacts.

High security is very important in social networks. One of the problems is spammers, who can steal
users’ passwords and send spam messages or do other bad things.

According to security policy of V Contacts each password consists of five lowercase or uppercase English
letters or digits. Vasya wants to analyze a database of all users’ passwords in order to know its security
level. The security level depends on how many pairs of passwords are the same, differ in one position,
two positions, etc.

Input Format

The input file contains several test cases. It ends with EOF.
The first line of each test case contains one integer number n — the total number of users of V Contacts
(1 ≤ n ≤ 50 000). Each of the following n lines contains a single user password.

Output Format

The output file should contain six numbers ai (0 ≤ i ≤ 5) — the number of pairs of passwords which are
different in exactly i positions.

Sample Input 1

3
abcde
ABCDE
12345
7
aaaaa
aaaaa
aaaa1
aaaA2
aaBCD
a6543
XxXxX

Sample Output 1

0 0 0 0 0 3
1 2 3 4 5 6

Hints

Problem Source

Migrated from old NTUJ.

ACM ICPC 2011–2012, NEERC, Northern Subregional Contest

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 8000 65536 200