Measurement of jet fragmentation into charged particles in pp and PbPb collisions at sqrt(s_NN) = 2.76 TeV