program4 solution