Editor settings

General settings

Save settings

Learn to program with Python

Find first non-repeated character #

Write a function that takes a string as input and returns the first non-repeated character in the string while ignoring the case. If there are no non-repeated characters, the function should return None.

Repeated characters is a character that is repeated directly next to each other. For example, "aa", "Aa", and "aAa", are all repeated characters, but "aba" is not.


Tests #

  • find_first_non_repeated_character("aabbccdd") should return None
  • find_first_non_repeated_character("aabbccd") should return "d"
  • find_first_non_repeated_character("abcd") should return "a"
  • find_first_non_repeated_character("001112222233454") should return "4"
  • find_first_non_repeated_character("aaABbbcC00==5665OO") should return "5"
Output will be displayed here