I rewrote my program again, this time concentrating on dealing with the dashes between lines of numbers and got my answer accepted. Re-re-re-re reading the specifications finally sunk in and I understood that I had to test line length properly before printing the lines of dashes. It is a pretty simple problem actually once the tricky parts are dealt with. Line by line debugging using tests like 1*12345 and 999*101 really helped me narrow down the problems my code was having.
One good thing about these problems is that I am learning how to debug efficiently and to read the problems carefully. Probably like a lot of beginners I code first and lay out the problem second. That is not good. Russians, I have read, are/were some of the best programmers because they had computer time limitations so they had to do what everyone should do: layout the inputs, outputs, and program logic first on paper, then enter the code.
Thanks for your help.