import std.algorithm, std.array, std.range; import std.string, std.conv; import std.math; import std.stdio, std.typecons; void main() { auto rd = readln.split; auto w = rd[0].to!int; auto h = rd[1].to!int; auto c = rd[2]; foreach (i; 0..h) { writeLine(w, c); c = rev(c); } } void writeLine(int w, string c) { foreach (i; 0..w) { write(c); c = rev(c); } writeln; } string rev(string c) { return c == "B" ? "W" : "B"; }