Size-induced acoustic hardening and optic softening of phonons in InP, CeO2, SnO2, CdS, Ag, and Si nanostructures