Your home directory contains a list of files. All the filenames have equal length. When you type a command in the form "dir PATTERN", it will show all the filenames that match the specified pattern. A pattern can contain only letters ('a'-'z'), '.' characters, and '?' symbols. Each '?' matches any single character (including '.'), and all other characters match only themselves. For example, the pattern "conte?t.info" matches the filenames "contest.info" and "content.info", but not "contemn.info" or "contests.nfo" (all quotes for clarity only).
You are given a String[] filenames, where each element represents the filename of a single file in your home directory. Return the pattern that will match all the filenames while containing as few '?' symbols as possible.
|