Pergunta de entrevista da empresa Arkadium

Write an optimized algorithm to read a string and count the number of times each letter appears.