KARTA | 프로그래밍의 벗 PivotOJ
PivotOJ

KARTA

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2007 National Competition #2 - JuniorsBOJ 3145

문제

A geographical map is represented with R×C characters. 

There are towns on the map. The position of a town is marked with the lowercase letter 'x', and the name of the town is a sequence of consecutive uppercase letters read from left to right. Each town's name is next to its position. More precisely, at least one letter in a town's name is in one of the 8 squares around the town's position. 

There may be multiple names surrounding a town's position and, similarly, there may be multiple town positions adjacent to a name. However, it is guaranteed that it is possible to uniquely determine the positions and names for all towns. 

Write a program which determines the positions and names of all towns. 

입력

The first line of input consists of two integers, R and C (1 ≤ R ≤ 50, 1 ≤ C ≤ 50), the numbers of rows and columns. 

Each of the next R lines contains C characters, the map. Each character is either '.', 'x', or one of the uppercase letters of the English alphabet. 

The town names will be unique. Town names in the same row will be separated by at least one '.' or 'x'character. 

출력

For each town, output a line containing its position on the map and its name. The rows are numbered 1 to R (top to bottom) and the columns are numbered 1 to C (left to right). The towns can be printed in any order. 

예제

예제 1

입력
12 31
...............................
.............ZAGREB............
..............x................
.......................OSIJEKx.
.....x.........................
......RIJEKA...................
...............................
...............................
...............................
..............SPLIT............
...............x...............
...............................
출력
3 15 ZAGREB
4 30 OSIJEK
5 6 RIJEKA
11 16 SPLIT

예제 2

입력
3 8
.VELIKI.
x.....x.
..MALI..
출력
2 1 VELIKI
2 7 MALI
코드를 제출하려면 로그인하세요.