The Mars Exploration Rovers (MER) have transmitted to Earth over
50,000 images of the Martian surface. These images are vailable to
the public via the Jet Propulsion Laboratory's web site. The images
are stored in 31-character filenames: a 27-character long name and a
4-character .JPG extension. Groups of character positions within the
name encode information about each image, such as Spacecraft ID,
Camera, Spacecraft clock, Product type, Camera filter, and
more.
Since most of this information has limited variability, in a list of
image filenames many of the filenames may be very similar. Given a
list of MER image filenames, identify the smallest set of character
positions that could be used to identify the filenames uniquely. For
the name portion of the filename, the leftmost character position is
1, the rightmost is 27. If there are multiple smallest sets, highest
precedence goes to the leftmost character positions.
Input is a sequence of groups of MER filenames, one filename per
line. Groups are separated by a separator line, "SEP". A group will
have at least two and at most 1,000 filenames. Fileanems are unique
within a group. The name portion consists of only numeric digits and
uppercase alphabetic characters.
Output one line for each group of filenames. On the line, list the
highest precedence set of character positions that could be used to
identify all the filenames uniquely in the group. List the
characters' positions in increasing order, separated by exactly one
space. Output "NO SET" if more than ten character positions are
required to identify the filenames uniquely.
Sample input
Sample output