pset1/greedy.c, complete