Encuentra el primer carácter que no se repite

Crea un método que reciba una cadena de texto como argumento y devuelva el primer carácter que no se repite.

Ejemplos

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

  • Si la cadena está vacía, devuelve "Invalid".
  • Si todos los caracteres se repiten, devuelve "Invalid".
  • No te preocupes por las diferencias entre mayúsculas y minúsculas ni por los caracteres no alfanuméricos.
  • Esta versión de Java con String usa "Invalid" cuando no hay resultado, al igual que las versiones originales en lenguajes de tipado estático.