Minimum Hamming Distance
Given
n
bit-strings, you are asked to find the pair of bit-strings that has the minimum hamming distance. Input
The first line of the input contains a single integer
n
(2 ≤ n ≤ 1000).The next
n
lines contain bit-strings of the same length each on a separate line (1 ≤ || ≤ ). Output
The program should print the minimum hamming distance of those pairs.
Examples
Input | Output |
4
1111
1010
0000
1011 | 1 |
Explanation
The hamming distance between
1011
and 1010
is 1.Constraints
Time limit: 6 seconds
Memory limit: 512 MB
Output limit: 1 MB