Problem 14

This is a really inefficent solution