Hi all.

I'm doing an exercise where given a text file with words written in
columns or vertically, I have to put in another file, but horizontally.

For example, I have the file:

NNNNNNNN
AAAAAAAA
MMMMMMMM
EEEEEEEE
OTTFFSSE
NWHOIIEI
EORUVXVG
ERE ET
E   NH

I seek to place their names in another file like this:

NAMEONE
NAMETWO
NAMETHREE
NAMEFOUR
NAMEFIVE
NAMESIX
NAMESEVEN
NAMEEIGHT

This is the code you were doing (in this case I use an array to test if
it worked):

#########################################################################f = File.new ("names1.txt", "r")
#j = File.new ("names2.txt", "w+")
a = []
b = []

f.each do |line|
 a.push(line)
end
f.close

rows = 7
columns = 8

for i in 0..rows-1
 for j in 0..columns-1
 b.push(a[i][j])
end

puts b

########################################################################

The issue is that I find the way the words are written horizontally, if
I try to access their values one by one, it seems that the place
properly, but if I use a cycle does not work.

Thanks