We can use a system of equations to solve this.
Length 1 = x
Length 2 = y
Set up the system.
2x+2y=38
x+1=4y
Isolate the variable on one equation.
x=4y-1
Substitute that into the other equation.
2(4y-1)+2y=38
Solve.
8y-2+2y=38
10y=40
y=4
Substitute back into other equation.
x=4(4)-1=16-1=15
The lengths are 15 cm and 4 cm.
Hope this helps!