The total distance is the sum of each part of the travel (just the absolute value), and the displacement is the sum considering the direction (let's consider north and east as positive directions, and west and south as negative directions).
So we have that:
5. 5 cm east, 10 cm west
distance = 5 + 10 = 15 cm
displacement = |5 - 10| = |-5| = 5 cm
6. 15 cm north, 10 cm east, 15 cm south, 3 cm west
distance = 15 + 10 + 15 + 3 = 43 cm
displacement (vertical) = 15 - 15 = 0 cm
displacement (horizontal) = 10 - 3 = 7 cm
displacement = 7 cm
7. 12 cm east, 15 cm south, 12 cm west, 19 cm north
distance = 12 + 15 + 12 + 19 = 58 cm
displacement (vertical) = -15 + 19 = 4 cm
displacement (horizontal) = 12 - 12 = 0 cm
displacement = 4 cm