Central String
시간 제한3초메모리 제한1024 MB
길이가 같은 N개의 문자열과 거리 한계 D가 주어질 때, 모든 문자열과 해밍 거리가 D 이하인 문자열이 존재하는지 판정하고 그런 문자열 하나를 출력한다.
문제
You have a collection of strings of the same length and are wondering how similar they are. We can say that the distance between two strings and of the same length is the number of indices where . For example, berry, bears since only the third and fifth characters differ.
You wonder if your strings are very close to each other. That is, for a given distance you have in mind, is there a string of length such that for each string in your collection? Call such a string a central string. Note that a central string does not necessarily have to be one of your strings.
입력
The first line of input contains three integers (), (), and (). Here, indicates the number of strings in your collection, is the common length of these strings, and is the distance bound you are curious about. Then lines follow, the ’th such line contains a single string of length consisting of only lowercase letters.
You are further guaranteed that .
출력
Output consists of a single line. If there is a string consisting of only lowercase letters such that for each , output any such string. Otherwise, simply output the single digit 0 to indicate there is no central string.