solution for first part
solution for first part