SP6949 CTOI10D2 - PIN
Description
Martin has just been hired as a computer administrator in a big company. The company did not change its authorization system since 1980s. Every person has a four-digit personal identification number (PIN). Nobody uses usernames or passwords, you can login just by typing your PIN. As the company grew, they added the possibility to use letters as well, but the length of the PIN remained the same.
Martin is not happy with the situation. Suppose there are people whose PINs differ only at a single place, for example 61ab and 62ab. If the first person accidentally presses 2 instead of 1, the system would still let him in. Martin would like to make the statistics about the PINs currently in use, in particular, compute the number of pairs of PINs that differ at 1, 2, 3 or 4 positions. He hopes that these numbers will be alarming enough to convince his boss to invest in a better system.
**Task specification**
----------------------
Given the list of PINs and an integer _D_, find the number of pairs of PINs that differ at exactly _D_ positions.
**Input specification**
-----------------------
The first line of the input contains two space-separated positive integers _N_ and _D_, where _N_ is the number of PINs and _D_ is the chosen number of differences. Each of the following _N_ lines contains a single PIN.
**Constraints**
---------------
You may assume that in all test cases ![2\leq N\leq 50\,000](https://cdn.luogu.com.cn/upload/vjudge_pic/SP6949/724a91186d56c46e93587076974c2be1b3598c30.png) and ![1 \le D \le 4](https://cdn.luogu.com.cn/upload/vjudge_pic/SP6949/edd5b6b98df4f60fbde0b87adc3d362431b930b7.png).
Each PIN is of length 4 and each character is either a digit or a lowercase letter between 'a' and 'z', inclusive. You may assume that all PINs in the input are different.
In test cases worth 15 points, ![N\leq 2000](https://cdn.luogu.com.cn/upload/vjudge_pic/SP6949/1a270f9c8dfe25fbbfb9ae895a7fe1d982247f2c.png).
In test cases worth 60 points, ![D\leq 2](https://cdn.luogu.com.cn/upload/vjudge_pic/SP6949/461693dbaacc9353c2b9cc1581b5cf114069c2e3.png). Out of those, in test cases worth 30 points, _D_ = 1.
In test cases worth 75 points, every PIN will only consist of digits or lowercase letters between 'a' and 'f', inclusive. Thus it can be viewed as a hexadecimal number.
**Output specification**
------------------------
Output a single line with a single number: the number of pairs of PINs that differ at **exactly** _D_ positions.
**Examples**
------------
**input:**
```
4 1
0000
a010
0202
a0e2
```
**output:**
```
0
```
_For these PINs each pair of PINs differs at more than one position._
**input:**
```
4 2
0000
a010
0202
a0e2
```
**output:**
```
3
```
_There are three pairs that differ at exactly 2 positions: (0000,_a_010), (0000,0202), and (_a_010,_a_0_e_2)._
Input Format
N/A
Output Format
N/A