Problem #13 soltion.