Pergunta de entrevista da empresa Autodesk

Given a string return the occurrences of each unique element?