Solution of second assigment