brute-force solution to problem 35 added