시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 512 MB0000.000%

문제

After Coding Cup grew to over $100\,000$ participants, our website codingcup.se faced a new problem. Spammers started to register domain names that were deceptively similar to ours, differing in just a single letter (such as codingcap.se). Unsuspecting participants sometimes visited these domains instead due to a typo.

After losing a huge chunk of users due to these spam domains, it was time to fight back. Working together with the local Internet domain registrars, you got access to the list of \emph{all existing domains}. Using this data, you want to try to find domains that are under attack by these spammers.

For each of the registered domains, your task is to find the number of other domains that can be obtained by changing a single letter of the domain to another letter.

입력

The first line of input contains an integer $N \ge 1$, the number of domains.

The next $N$ lines contain one (non-empty) domain name each, consisting only of characters a-z and 0-9. No domain appears twice in the input.

We assume all domains have the same ending (.se), so this is not included in the input domain names.

출력

For each of the $N$ domain names, output the number of other domains that only differ by one character. The answers for the domains should be output in the same order as they appear in the input.

제한

Let $S$ be the sum of the lengths of all domain names in the input.

  • $S \le 3\,000\,000$

예제 입력 1

4
a
b
aa
bb

예제 출력 1

1
1
0
0

예제 입력 2

3
kodsport
kodsp0rt
k0dsport

예제 출력 2

2
1
1