The giant dipole resonance and its charge-exchange analogs