def ascan; gets.split.map(&:to_i);end r,k = ascan h,w = ascan r/=90 field = [] h.times{ field << gets.chomp } r.times{ new_field = Array.new(w){"%"*h} w.times{|y| h.times{|x| new_field[y][x] = field[h-x-1][y] } } h,w = w,h field = new_field } field.map!{|l| l.chars.map{|s| s*k}*"" } field.each{|l| k.times{puts l} }