solution to problem 6 done
small edits