problem 12 - takes too long to run