QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100

#3762. 2020 vs 2018

统计

Aside: Do you remember the Hunan Provincial Contest in 2018 that asked you to output a 2018 ASCII art?

Bobo has an ASCII art of $n$ rows and $m$ columns, containing only the characters . and o. The . represents the background, and the o characters form either 2018 or 2020. Please identify whether the given ASCII art is 2018 or 2020.

Input

The input contains multiple test cases. Process until the end of the file.

The first line of each test case contains two integers $n$ and $m$. The next $n$ lines each contain $m$ characters representing the ASCII art.

  • $1 \leq n, m \leq 50$
  • The number of test cases does not exceed $100$.
  • The ASCII art:
    • Contains only . and o characters;
    • Will only be an ASCII art of 2018 or 2020;
    • The o characters of different digits will not be adjacent (in any of the $8$ directions);
    • The strokes are all horizontal or vertical, but they may appear in any size and position.

Output

For each test case, if the given ASCII art is 2020, output 2020; otherwise, output 2018.

Examples

Input 1

6 14
..............
.oo.ooo.oo.ooo
..o.o.o..o.o.o
.oo.o.o.oo.o.o
.o..o.o.o..o.o
.oo.ooo.oo.ooo
6 14
....ooo....ooo
.oo.o.o..o.o.o
..o.o.o..o.ooo
.oo.o.o..o.o.o
.o..ooo..o.o.o
.oo......o.ooo
11 12
ooo...ooo...
o.o.....o...
ooo...ooo...
......o.....
ooooo.o.ooo.
o...o.o...o.
o...o.ooo.o.
o...o.....o.
o...o...ooo.
o...o...o...
ooooo...ooo.

Output 1

2020
2018
2020

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.