add solution for problem 9

Totally brute-forced this one.