let there are X toffee in the bowl.
R takes ${\frac{1}{3}}^{rd}$ of the toffee ===> ${\frac{x}{3}}^{}$ toffees with R and remaining = ${\frac{2x}{3}}^{}$
But R returns 4 to the bowl ==> R took ${\frac{x}{3}}^{}-4$ toffees and remaining = ${\frac{2x}{3}}^{}+4$
S takes ${\frac{1}{4}}^{th}$ of the toffee from remaining ===> ${\frac{1}{4}}^{}({\frac{2x}{3}}^{}+4)$ toffees with S and remaining = ${\frac{3}{4}}^{}({\frac{2x}{3}}^{}+4)$ = $\frac{x}{2} + 3$
But S returns 3 to the bowl ==> S took ${\frac{1}{4}}^{}({\frac{2x}{3}}^{}+4)-3$ toffees and remaining = $(\frac{x}{2} + 3+3)$ = $\frac{x}{2} + 6$
T takes ${\frac{1}{2}}^{th}$ of the toffee from remaining ===> ${\frac{1}{2}}^{}({\frac{x}{2} + 6})$ toffees with T and remaining = ${\frac{1}{2}}^{}({\frac{x}{2} + 6})$
But T returns 2 to the bowl ==> T took ${\frac{1}{2}}^{}({\frac{x}{2} + 6})-2$ toffees and remaining = ${\frac{1}{2}}^{}({\frac{x}{2} + 6})+2$
Finally left in Bowl = ${\frac{1}{2}}^{}({\frac{x}{2} + 6})+2$ = $({\frac{x}{4} + 3}+2)$ = $({\frac{x}{4} + 5})$
$({\frac{x}{4} + 5})$ = 17
$({\frac{x}{4}})$ = 12
x=48