mix lines by s-nakajima

input = readlines
max_length = input.map { |i| i.size }.max
output = ''
max_length.times.map do |m|
  input.each do |l|
    output << l[m] unless l[m].nil?
  end
end
puts output.gsub(/\n/, '')

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page