problem 6 solution
help script to understand problem 6