My solution of the task