LTM Limited Interview Question

DSA question: return count of all the words