Pergunta de entrevista da empresa Microsoft

Return first non repeating character in a string and then optimize it.