solution for 1st exercise