Infosys interview question

word frequency in string