DZY Loves Chessboard

题意翻译

一个棋盘上有一些格子是坏的,另一些是正常的。对于每一个正常的格子,都要在上面放上棋子。 请找到一组解使没有两个相同颜色的棋子相邻(两个格子相邻为它们存在共同的边) 输入格式: 第一行为两个数n,m。(1<=n,m<=100) 下面n行,每个格子上的字符为'-'或'.','-'表示坏掉的格子,'.'表示正常的格子。 输出格式: 输出n行,每行m个字符。第i个字符串的第j个字符应为“W”,“B”或“ - ”。字符“W”是指在格子上放白色的棋子,“B”意味着放黑色的棋子,“ - ”表示坏掉的格子。 如果有多组答案,输出其中的一个 感谢@zhaotiensn 提供的翻译

题目描述

DZY loves chessboard, and he enjoys playing with it. He has a chessboard of $ n $ rows and $ m $ columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with the same color are on two adjacent cells. Two cells are adjacent if and only if they share a common edge. You task is to find any suitable placement of chessmen on the given chessboard.

输入输出格式

输入格式


The first line contains two space-separated integers $ n $ and $ m $ $ (1<=n,m<=100) $ . Each of the next $ n $ lines contains a string of $ m $ characters: the $ j $ -th character of the $ i $ -th string is either "." or "-". A "." means that the corresponding cell (in the $ i $ -th row and the $ j $ -th column) is good, while a "-" means it is bad.

输出格式


Output must contain $ n $ lines, each line must contain a string of $ m $ characters. The $ j $ -th character of the $ i $ -th string should be either "W", "B" or "-". Character "W" means the chessman on the cell is white, "B" means it is black, "-" means the cell is a bad cell. If multiple answers exist, print any of them. It is guaranteed that at least one answer exists.

输入输出样例

输入样例 #1

1 1
.

输出样例 #1

B

输入样例 #2

2 2
..
..

输出样例 #2

BW
WB

输入样例 #3

3 3
.-.
---
--.

输出样例 #3

B-B
---
--B

说明

In the first sample, DZY puts a single black chessman. Of course putting a white one is also OK. In the second sample, all $ 4 $ cells are good. No two same chessmen share an edge in the sample output. In the third sample, no good cells are adjacent. So you can just put $ 3 $ chessmen, no matter what their colors are.