William James wrote:

> the_list = gets(nil).split

If your strings can contain spaces, change to

the_list = gets(nil).split(/\n+/)