Old Nicol was actually a devout and principled man, who had profound insight into human nature and the politics of his time. Far more worthy of the pejorative implication is Cesare Borgia , the incestuous and multi-homicidal pope who was the inspiration for The Prince . The output of each program looks like this . This section is for displaying alternate solutions that are either slower than ones above or perhaps don't quite meet my criteria for the competition, but are otherwise worthy of comment. Here's an older Python program which is much slower.
Most languages benefit from reading input all at once, instead of line by line.