For the rectangle, you can make an expression
5x + 3 + 5x + 3 + 2x - 1 + 2x - 1 OR 2 (5x + 3) + 2 (2x - 1)
Combine Like Terms to get ...
14x - 4
For the triangle, add all of the sides that are shown:
2x - 2 + 7x + 6x.
Combine Like Terms to get ...
15x - 2