I don't program in Ruby myself so I could be wrong...
It seems Ruby, or the version we are using, or the way you use it, is to slow.
Programs are tested on relatively slow computers.
Maybe someone who knows Ruby has more interesting ideas...
I also tried to solve this problem the easy way some time ago.
It surprised me a little, but a short Java program using Bignum was way too slow, while a simple "school" algorithm written in C was way faster. Not to mention Karatsuba or FFT.
I might be misreading your code, but it seems you assume there are only two words in the input. There are more.
Your program outputs exactly nothing.
Noix