A midpoint is a point that divides a line into 2 equal smaller lines.
Therefore, given that B is the midpoint of AC, AB = BC.
BC = 5 -> AB = 5.
So, AC = 5 + 5 = 10.
We're given AD = 18, and AD is also equal to AC + CD.
AC = 10, therefore CD = 18 - 10 = 8.