Google Code Jam Practice Excercise C