Searches for long-lived charged particles in pp collisions at sqrt(s)=7 and 8 TeV