All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The two hadiths are authentic, as mentioned in the question, and Allah, the Almighty, says (what means): {Indeed, good deeds do away with misdeeds.} [Quran 11:114]
However, according to the preponderant opinion, the good deeds do not remove the major sins: they only do away with the minor sins, because the Messenger of Allah, sallallaahu ‘alayhi wa sallam, says:
The five (daily obligatory) prayers, from one Friday (prayer) to the next Friday (prayer), and from Ramadan to the next Ramadan, are expiations for whatever (sins and misdeeds committed) between them provided that the major sins are not approached. [Muslim] The major sins need special repentance from them.
So if the words uttered by that person belong to the major sins, like accusing others falsely and lying, they will not be expiated by fasting a day or many days in the cause of Allah. Rather, one must repent from them with sincere repentance of which the conditions should be met.
If, however, they are of the minor sins, then they can be erased by fasting or other good deeds.
Allah knows best.