| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 | 2048 MB | 14 | 14 | 14 | 100.000% |
A LED counter is a device having $N$ positions arranged in a single row. Each position is able to display a digit from 0ドル$ to 9ドル,ドル and is made of seven LEDs, as this picture shows.
To display a specific digit, just the appropriate LEDs are turned on. The following picture indicates which LEDs are turned on for each possible digit.
As you can see, all but the middle LED are turned on to display the digit 0ドル,ドル the upper-right LED and the bottom-right LED are turned on to display the digit 1ドル,ドル and so on.
By turning on the appropriate LEDs in each of the $N$ positions of the counter, the device is able to display 10ドル^N$ distinct values, from 00ドル \cdots 0$ ($N$ zeros) to 99ドル \cdots 9$ ($N$ nines). Note that leading zeros are displayed.
Astro Void has owned a LED counter for quite some time, and so the device might have some malfunctioning LEDs. While a good LED turns on or off when needed, a malfunctioning LED is always turned on or always turned off, independently of the intended value of the counter.
Given the description of the state of each LED in Astro Void’s LED counter (good LED that is turned on, good LED that is turned off, always-on LED, or always-off LED), you must tell the intended value of the counter, indicating which positions cannot be determined without ambiguity.
As an example of a LED counter with $N = 3$ positions, consider the picture below. If all the LEDs are good, then the intended value of the counter is of course 056ドル$. If the bottom LED of the first position is an always-on LED, then the intended value of the counter is still 056ドル,ドル because no other value would be displayed as the picture shows. However, if the bottom-left LED of the second position is an always-off LED, then the second position of the counter cannot be determined without ambiguity, since 056ドル$ and 066ドル$ would be displayed as shown.
The first line contains an integer $N$ (1ドル ≤ N ≤ 10^5$) indicating the number of positions in the LED counter.
The $i$-th of the next $N$ lines contains a string $S_i$ of length 7ドル$ describing the seven LEDs in the $i$-th position of the counter. Each character of $S_i$ describes a particular LED, from left to right and from top to bottom, that is, in the following order: upper-left, bottom-left, top, middle, bottom, upper-right and bottom-right. The character is either an uppercase letter “G” (good LED that is turned on), a lowercase letter “g” (good LED that is turned off), a plus sign “+” (always-on LED) or a hyphen “-” (always-off LED). It is guaranteed that $S_i$ describes valid states for the LEDs in the $i$-th position of the counter. For instance, $S_i$ is not “ggggggg”, because when all LEDs are good, no digit would be displayed with all of them turned off.
Output a single line with a string of $N$ digits indicating the intended value of the counter. If a position of the counter cannot be determined without ambiguity, output the character “*” (asterisk) instead of the corresponding digit.
10 GGGgGGG gggggGG gGGGGGg ggGGGGG GggGgGG GgGGGgG GGGGGgG ggGggGG GGGGGGG GgGGGGG
0123456789
3 GGGg+GG GgGGGgG GGGGGgG
056
3 GGGg+GG G-GGGgG GGGGGgG
0*6
2 +++gG-- ---gG++
00
1 -+-+-+-
*