Partial-wave analysis of the low-mass (π+π−p) system produced in the reaction pp→p(π+π−p) at 12 and 24 GeV/c