Let the total work be \( W \).
- B can complete the work in 48 days, so B’s rate of work is:
\[
\text{B’s rate} = \frac{W}{48}
\]
- In the first 10 days, A works alone. Let A’s rate of work be \( \frac{W}{a} \), where \( a \) is the number of days A would take to complete the work alone.
The work done by A in the first 10 days is:
\[
\text{Work done by A} = 10 \times \frac{W}{a} = \frac{10W}{a}
\]
After A leaves, B finishes the remaining work in 42 days, so the work done by B in 42 days is:
\[
\text{Work done by B} = 42 \times \frac{W}{48} = \frac{7W}{8}
\]
The total work is \( W \), so the remaining work after 10 days is:
\[
W - \frac{10W}{a} = \frac{7W}{8}
\]
Solving for \( a \):
\[
W - \frac{10W}{a} = \frac{7W}{8} \quad \Rightarrow \quad \frac{10W}{a} = \frac{W}{8} \quad \Rightarrow \quad a = 80
\]
Thus, A can complete the work in 80 days.
Now, we calculate the time taken for A and B to complete the work together. Their combined rate is:
\[
\text{Combined rate} = \frac{W}{80} + \frac{W}{48} = \frac{48W + 80W}{80 \times 48} = \frac{128W}{3840} = \frac{W}{30}
\]
Thus, A and B together will complete the work in \( \boxed{30} \) days.