Differences
시간 제한2초메모리 제한1024 MB
길이가 같은 A~D 문자열 N개가 주어질 때, 다른 모든 문자열과의 거리가 정확히 K인 특별한 문자열의 번호를 찾는다(없으면 -1).
문제
We have a list of strings . All strings have length and consist only of characters A, B, C and D. Let us define the distance between two strings and as the number of indices , where the strings have different characters (). We know that the list of strings contains precisely one special string that has distance to all other strings. Note that there might be other pairs of strings with a distance of . We are experiencing problems finding this special string, so please write a program to help us out.
입력
The first line contains space-separated integers , and . Strings are given in the following lines.
출력
Output the index of the special string. Strings are numbered from to as given in the input.