Rubyize the output code

Change the printf statements in the output lines to print statements
using the str % arg -> str public instance method of Class::String.

This code's a little easier on the eyes.
Disambugate variable names

Rename several variables for greater readability and greater clarity
of intent.