Trump dismisses Jimmy Carter’s attacks on his legitimacy: ‘He was a terrible president’