if we refer to the longest side as x and the shortest side as y and the medium side as z then we come up with this formation:
x+y+z= 22
y is shorter than x by 5 inches so y= x-5
z is longer than y by 2 inches therefore z= x-5 +2
therefore:
x+(x-5)+(x-5+2)=22
x+x-5+x-5+2=22
3x-8=22
3x= 22-8
3x=14
x=

replace x in y and z in previous formations