Encontre o primeiro caractere que não se repete

Crie um método que receba uma string como argumento e retorne o primeiro caractere que não se repete.

Exemplos

Program.firstNonRepeatedCharacter("g") ➞ "g"

Program.firstNonRepeatedCharacter("it was then the frothy word met the round night") ➞ "a"

Program.firstNonRepeatedCharacter("the quick brown fox jumps then quickly blows air") ➞ "f"

Program.firstNonRepeatedCharacter("hheelloo") ➞ "Invalid"

Program.firstNonRepeatedCharacter("") ➞ "Invalid"

Notas

  • Se a string estiver vazia, retorne "Invalid".
  • Se todos os caracteres se repetirem, retorne "Invalid".
  • Não se preocupe com diferenças entre maiúsculas e minúsculas nem com caracteres não alfanuméricos.
  • Esta versão em Java com String usa "Invalid" quando não há resultado, assim como as versões originais em linguagens de tipagem estática.