- Time limit: 1.00 s
- Memory limit: 512 MB
The Hamming distance between two strings and of equal length is the number of positions where the strings differ.
You are given bit strings, each of length and your task is to calculate the minimum Hamming distance between two strings.
Input
The first input line has two integers and : the number of bit strings and their length.
Then there are lines each consisting of one bit string of length .
Output
Print the minimum Hamming distance between two strings.
Constraints
Example
Input:
5 6 110111 001000 100001 101000 101110
Output:
1
Explanation: The strings 101000
and 001000
differ only at the first position.