added solution for prob 6