The longest side of a triangle is 5 in. longer than the shortest side. The medium side is 4 in. longer than the shortest side. If the perimeter of the triangle is 24 ​in., what are the lengths of the three​ sides?