# 入力された値を受け取る 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" when "W" then (i + 1).odd?? str = "WB": str = "BW" end # puts (str * width)[0..(width - 1)] puts (str * width)[0, width] end