W, H, C1 = gets.chomp.split intw = W.to_i inth = H.to_i C2 = C1 == "B" ? "W" : "B" (1..inth).each do |n| (1..intw).each do |i| puts create_chars(n, i) end end def create_chars(n, i) output = [] if (n.odd? && i.odd?) || (n.even? && i.even?) output.push(C1) else output.push(C2) end output.join end