Yeah, the solution is to have a functioning rehabilitation system. But in the US, with the system we currently have, it doesn't seem to make a difference how long you keep them there. We actually have a higher recidivism from our rehabilitation than from doing nothing at all.
So, in order of effectiveness:
- Effective rehabilitation
- Nothing
- American prison system
The only benefit to a long sentence is that it reduces the number of years they can spend harming children, though there's a fairly high chance they abuse fellow inmates instead, who could then become abusers themselves once they get out, so the whole thing is fucked and stupid.