I was going through a biophysics paper (Berglund, Phys Rev E Stat Nonlin Soft Matter Phys. 2010 Jul) and derived the main pieces of interest but ran into this difference of two integrals:$$R=\frac{1}{\Delta t}\left[\int \limits _0^{\Delta t}dt \int \limits _0^{\Delta t}dt's(t)s(t')\min (t,t')-\int \limits _0^{\Delta t}ts(t)\,dt\right],$$where $\Delta t$ is positive and $s(t)$ is a non-negative function that integrates to one over $[0,\Delta t]$ (i.e. $\displaystyle \int \limits _0^{\Delta t}s(t)\,dt=1$).
The question is, this is supposed to be equal to$$R=\frac{1}{\Delta t}\int \limits _0^{\Delta t}S(t)[1-S(t)]\,dt,$$where $\displaystyle S(t)=\int \limits _0^ts(t')\,dt'$.
Why is this? Why is
$$ \frac{1}{\Delta t} \left[ \int \limits _0^{\Delta t}dt\int \limits _0^{\Delta t}dt's(t)s(t')\min (t,t')-\int \limits _0^{\Delta t}ts(t)\,dt \right]=\frac{1}{\Delta t} \int \limits _0^{\Delta t}S(t)[1-S(t)]\,dt$$?
Any hints appreciated. Even though I studied math in college I don't do integrals very often anymore so any leads are helpful.