Pergunta de entrevista da empresa DP World

Find the occurrence of each character in a string