modified:   greedy.c
Done after epic struggle with break/continue