Not the best way to do problem 3. But it works. Would really have liked to
grouped it into a class like I did on the previous one. It's so much
cleaner and easier to solve other similar problems. Looking at this code
gives me a headache...