My solution for ch 1 pr 5