QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#7590. Penguin QQ

الإحصائيات

PenguinQQ is one of the largest and most influential SNS (Social Networking Services) in China. Based on a real-name system, it provides users with a rich and powerful internet experience, including blogs, groups, instant messaging, photo albums, marketplaces, and more, meeting various needs for social interaction, information, entertainment, and transactions.

Little Q is an administrator for the PenguinQQ website. He has recently been conducting an interesting study: identifying which accounts are registered by the same person. After long-term analysis, Little Q discovered that account names registered by the same person are often very similar, for example, Penguin1, Penguin2, Penguin3, etc. Therefore, Little Q decided to first perform statistics on these similar cases.

Little Q defines that two account names are similar if and only if these two strings have the same length and differ by exactly one character. For example, "Penguin1" and "Penguin2" are similar, but "Penguin1" and "2Penguin" are not. Little Q wants to know how many pairs of similar account names there are among a given set of $N$ account names.

To simplify your task, Little Q gives you $N$ strings, all of length $L$, containing only uppercase letters, lowercase letters, digits, underscores, and '@', for a total of 64 possible characters. Furthermore, no two account names are identical.

Input

The first line contains three integers $N$, $L$, and $S$. $N$ represents the number of account names, $L$ represents the length of the account names, and $S$ represents the size of the character set, which can only be 2 or 64.

If $S$ is 2, the account names contain only the characters '0' and '1', for a total of 2 types.

If $S$ is 64, the account names may contain uppercase letters, lowercase letters, digits, underscores, and '@', for a total of 64 types.

Following this are $N$ lines, each containing a string of length $L$ describing an account name. It is guaranteed that the $N$ strings are all distinct.

Output

Output a single integer representing the total number of pairs of similar account names.

Examples

Input 1

4 3 64
Fax
fax
max
mac

Output 1

4

Note 1

The 4 pairs of similar strings are: Fax and fax, Fax and max, fax and max, max and mac.

Input 2

See the files penguin/penguin.in and penguin/penguin.ans in the contestant directory.

Constraints

Test Case ID $N$ $L$ $S$
1 50 10 64
2 500 100 64
3 3000 100 2
4 3000 100 64
5 30000 50 2
6 30000 50 64
7 30000 200 2
8 30000 200 64
9 30000 200 2
10 30000 200 64

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.