The longest side of a triangle is 4 inches than the shortest side. The medium side is 2 inches longer than the shortest side. If the perimeter of the triangle is 18 inches, what are the lengths of the three sides?