Time limit
1s
Memory limit
128 MB
You are given several sets of text strings. In each set, all strings have the same length. A lowercase letter is a readable character, and * is an unreadable character.
A set of remaining strings is consistent if it can be viewed as coming from one original string without contradiction. In other words, at every position, all readable characters that remain must be the same letter.
Consider these four strings.
ap***ab*leapp*e*p**eAfter removing the second string, the remaining strings are consistent.
For each set of strings, decide whether removing no more than the allowed number of strings can make the remaining strings consistent.
The input contains a sequence of string sets. Each set starts with a line containing the number of strings n and the maximum number of strings k that may be removed. The next n lines contain one string each.
Each string has length at least 1 and at most 250, and contains only lowercase letters and *. All strings in one set have the same length, and a set contains no more than 10,000 strings.
The input ends with a line containing 0 0.
For each set, print Yes if the strings can be made consistent by removing at most k strings. Otherwise, print No.
ap***ab*leapp*e*p**e