def ascan; gets.split.map(&:to_i);end r,k = ascan h,w = ascan r/=90 field = [] #h.times{ # field << gets.chomp #} h=0;w=0 while cin = gets cin.chomp! h+=1 w = cin.size field << cin end 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} }