create and slove problem 14. well, this solution is pretty slow...