I think the diagram I've drawn below is what you are describing. I've added (in blue) my own lines that will help.
Recall that when two circles are touching each other, there is a straight line between their centers which is the sum of the two radii. That means that the length of line segment OC is 4+7=11 cm. The line CX that I've drawn is perpendicular to OA. That means you can calculate the length OX by subtracting the radii. Now you have a right triangle OXC with two sides known. If you use Pythagorus to solve for the length CX, then you've also solved the length AB because the bottom shape is a rectangle.
Hope this helps!