Problem 7 - bruteforce solution