Answer
$3$ hours, $40$ dollars.
Work Step by Step
Step 1. Let $y_1$ be the cost for renting from Company-A; we have $y_1=22+6x$, where $x$ is the number of hours you need to rent the rug cleaner.
Step 2. Let $y_2$ be the cost for renting from Company-B; we have $y_1=28+4x$
Step 3. Let $y_1=y_2$; we have $22+6x=28+4x$, which gives $2x=6$ and $x=3$ hours.
Step 4. At $x=3$, we have $y_1=y_2=22+6(3)=40$ dollars.
Step 5. We conclude that after $3$ hours the total amount spent at each company will be equal to $40$ dollars.