python solution for problem 58
python solution for problem 58