Taking antacids for heartburn may reduce the chance of getting certain types of cancer.