Probing the chiral magnetic wave in pPb and PbPb collisions at root S-NN=5.02 TeV using charge-dependent azimuthal anisotropies