Weather Forecaster

No attempts yetTime limit1sMemory limit256 MB

Problem

City JOI is a rectangle H kilometers long from north to south and W kilometers long from west to east. The whole city is divided into H×WH \times W square blocks, each 1 kilometer on a side. The block that is i-th from the north and j-th from the west is written (i, j).

A block may or may not have a cloud above it right now. Every cloud moves exactly 1 kilometer east each minute. The weather is clear today, so no cloud ever enters City JOI from outside. A cloud that crosses the eastern border leaves the city and never comes back.

You know which blocks have a cloud above them right now. You work at the weather bureau, and your job is to predict, for every block, how many minutes from now a cloud first arrives above it.

Input

The input has 1 + H lines.

The first line contains two integers H and W (1H1001 \le H \le 100, 1W1001 \le W \le 100) separated by a single space. City JOI is divided into H×WH \times W blocks.

Each of the next H lines contains a string of W characters. On the i-th of those lines (1iH1 \le i \le H), the j-th character (1jW1 \le j \le W) gives the current state of block (i, j). It is the lowercase letter 'c' if a cloud is above that block right now, and '.' if there is none.

Output

Print H lines. Each line holds W integers separated by single spaces. The j-th integer on the i-th line (1iH1 \le i \le H, 1jW1 \le j \le W) is the number of minutes from now until a cloud first arrives above block (i, j). Print 0 if a cloud is already above that block, and -1 if no cloud ever arrives above it.

Hint

In the first sample City JOI is divided into 3 × 4 blocks, and clouds are above (1, 1), (1, 4) and (2, 3) right now. After 1 minute clouds are above (1, 2) and (2, 4), and the cloud that was above (1, 4) has crossed the eastern border and left the city. After 2 minutes only (1, 3) has a cloud above it, and after 3 minutes only (1, 4) has one. After 4 minutes no cloud is left in the city. No cloud ever reaches the third row, so every answer on that row is -1.