The perimeter of a right triangle is 24 centimeters. Three times the length of the longer leg minus two times the length of the shorter leg exceeds the hypotenuse by 2 centimeters. What are the lengths of all three sides?