how to count the highlighted words in Algolia search

Hello guys how could I count number of highlighted words in Algolia search including the duplicate word in the same hit