If a person forgot he was fasting and blessed, he should taste a little, so that the blessing not be in vain. If he already ate, he continues the fast. As the Rambam and the Chafetz Chaim wrote, a person should distance himself from smoking, because of “you shall guard yourselves very well for your lives.” On the three fasts, only eating and drinking are forbidden.