P27927 [洛谷] [Information and Future 2024] Traffic Lights
普及
题目描述

Problem Description

A seven-segment display is an electronic component used to display numbers, consisting of seven small illuminated segments arranged in the shape of the number 8. By lighting different segments, the display can show numbers from 0 to 9. Each segment is named from A to G, arranged and named as shown in the figure below:

The display shows different numbers by lighting different segments. For example:

  • The number 0 requires segments A, B, C, D, E, F to be lit.
  • The number 1 requires segments B, C to be lit.
  • The number 2 requires segments A, B, D, E, G to be lit.

Dr. X has noticed that the seven-segment display on traffic lights often malfunctions, which can be categorized into two types: always on and always off:

  • If a segment is always on, it remains lit at all times.
  • If a segment is always off, it remains unlit at all times.

Today, Dr. X feels that a number on the traffic light is displaying abnormally, so he has recorded the log of the display. Dr. X hopes you can infer the possible malfunction of each segment based on the log.

Input Format

The first line of the input data contains an integer $n$, representing the number of logs Dr. X has recorded. The next $n$ lines each contain a log (a string):

  • The log starts with a number $k (0 \leq k \leq 9)$, representing the observed number.
  • Following the number are several letters (A to G, and each letter appears at most once), representing the segments of the seven-segment display that are observed to be lit when displaying the number $k$. The log accurately and completely records the lit segments, and during the logging process, the state of the traffic light remains unchanged: segments that are always on remain so, segments that are always off remain so, and normal segments remain normal. There may be multiple records of the same number, but they will not contradict each other.

Output Format

Output one line with 7 characters, representing the status of segments A to G of the seven-segment display. For each segment, if there is evidence that it is always on, output the uppercase letter X. If there is evidence that it is always off, output the lowercase letter x, otherwise output a hyphen -.

Sample Input and Output

Sample Input #1

3
1BCD
7BCD
7DCB

Sample Output #1

x--X---

Sample Input #2

3
0
1
8G

Sample Output #2

xxxxxx-

Notes

For $100\%$ of the data, it is guaranteed that $0 \leq n \leq 100$.

The original full score for this problem was $15\text{pts}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1BCD 7BCD 7DCB
样例输出
x--X---