fork(22) download
  1. #include <cstdio>
  2. using namespace std;
  3.  
  4. int n, m;
  5. char S[1100];
  6.  
  7. int main() {
  8. scanf("%d%d", &n, &m);
  9. for (int i = 0; i < n; i++) {
  10. scanf("%s", S);
  11. for (int j = 0; j < m; j++)
  12. if (S[j] == '.') {
  13. if ((i + j) & 1) S[j] = 'W';
  14. else S[j] = 'B';
  15. }
  16. printf("%s\n", S);
  17. }
  18. }
  19.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Standard output is empty