# 入力された値を受け取る W, H, C = gets.chomp.split width = W.to_i # H行分出力する H.to_i.times do |i| case C when "B" then (i + 1).odd?? str = "BW": str = "WB" puts (str * width)[0..(width - 1)] when "W" then (i + 1).odd?? str = "WB": str = "BW" puts (str * width)[0..(width - 1)] end end