(ℓ, d) pattern
Time limit2sMemory limit512 MB
Find the unique length-l lowercase string within Hamming distance d of some substring in every given string.
- Level
Medium6 of 10
- Topics
- Brute force, String matching
- Solved
- No attempts yet
Problem
You are given strings . Every character in them is a space or one of the 26 lowercase letters a to z.
For two constants and , compute an -pattern of this set of strings. An -pattern is a string of length that satisfies the following property.
- For every , the string contains at least one substring of length whose Hamming distance from is at most .
The Hamming distance between and is the number of positions with . A substring is consecutive characters, and it may contain a space.
consists of lowercase letters only. The input is always such that exactly one -pattern exists.
Input
The first line contains two integers and separated by a space. (, )
The second line contains the number of strings . ()
Each of the next lines contains one string, in the order . Each string has length at most 50 and uses only spaces and lowercase letters. A pattern exists, so every string has length at least .
Output
Print the -pattern on the first line.