시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 21 13 12 66.667%

문제

지리지도는 R*C개의 글자로 나타낸다.

어떤 조그만 나라의 지도가 있다. 여기서 마을은 소문자 'x'로 표시되어 있고, 마을의 이름은 알파벳 대문자로 나타내고, 왼쪽에서 오른쪽으로 읽는다.

각 마을의 이름은 그 위치의 옆에 있다. 조금 더 자세히 설명하자면, 적어도 하나의 마을의 이름의 문자는 마을의 위치의 인접한 8개의 칸 중에 하나에 있다.

마을의 근처에 이름이 여러 개가 있을 수도 있고, 이름의 근처에 마을이 여러 개 있을 수도 있다. 하지만, 항상 마을의 위치와 이름을 유일하게 결정할 수 있다.

이때, 각 마을의 위치와 이름을 알아내는 프로그램을 작성하시오.

입력

첫째 줄에 행과 열의 개수 R과 C가 주어진다. (1 ≤ R ≤ 50, 1 ≤ C ≤ 50)

다음 R개의 줄에는 지도를 나타내는 C개의 문자가 주어진다. 각 문자는 '.', 'x', 또는 대문자이다.

마을의 이름은 항상 서로 다르다. 한 행에 여러 개의 마을 이름이 있을 때는, 적어도 하나의 '.'나 'x'로 구분되어 있다.

출력

각 마을의 위치와 이름을 한 줄에 하나씩 출력한다. 가장 위에서부터 1행부터 R행, 가장 왼쪽부터 1열부터 C열이다. 마을의 이름이 결정되는 방법이 여러 가지일 경우에는 아무거나 출력하면 된다. 또, 순서는 아무렇게 출력해도 된다.

예제 입력 1

12 31
...............................
.............ZAGREB............
..............x................
.......................OSIJEKx.
.....x.........................
......RIJEKA...................
...............................
...............................
...............................
..............SPLIT............
...............x...............
...............................

예제 출력 1

3 15 ZAGREB
4 30 OSIJEK
5 6 RIJEKA
11 16 SPLIT
W3sicHJvYmxlbV9pZCI6IjMxNDUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5YzBcdWI5YWNcdWM5YzBcdWIzYzQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzljMFx1YjlhY1x1YzljMFx1YjNjNFx1YjI5NCBSKk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mJzcDs8XC9wPlxyXG5cclxuPHA+RWFjaCBvZiB0aGUgbmV4dCBSIGxpbmVzIGNvbnRhaW5zIEMgY2hhcmFjdGVycywgdGhlIG1hcC4gRWFjaCBjaGFyYWN0ZXIgaXMgZWl0aGVyICYjMzk7LiYjMzk7LCAmIzM5O3gmIzM5Oywgb3Igb25lIG9mIHRoZSB1cHBlcmNhc2UgbGV0dGVycyBvZiB0aGUgRW5nbGlzaCBhbHBoYWJldC4mbmJzcDs8XC9wPlxyXG5cclxuPHA+VGhlIHRvd24gbmFtZXMgd2lsbCBiZSB1bmlxdWUuIFRvd24gbmFtZXMgaW4gdGhlIHNhbWUgcm93IHdpbGwgYmUgc2VwYXJhdGVkIGJ5IGF0IGxlYXN0IG9uZSAmIzM5Oy4mIzM5OyBvciAmIzM5O3gmIzM5O2NoYXJhY3Rlci4mbmJzcDs8XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCB0b3duLCBvdXRwdXQgYSBsaW5lIGNvbnRhaW5pbmcgaXRzIHBvc2l0aW9uIG9uIHRoZSBtYXAgYW5kIGl0cyBuYW1lLiBUaGUgcm93cyBhcmUgbnVtYmVyZWQgMSB0byBSICh0b3AgdG8gYm90dG9tKSBhbmQgdGhlIGNvbHVtbnMgYXJlIG51bWJlcmVkIDEgdG8gQyAobGVmdCB0byByaWdodCkuIFRoZSB0b3ducyBjYW4gYmUgcHJpbnRlZCBpbiBhbnkgb3JkZXIuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2007 > National Competition #2 - Juniors 2번

  • 문제의 오타를 찾은 사람: adh0463
  • 문제를 번역한 사람: baekjoon