Source code for kyu_6.first_character_that_repeats.first_character_that_repeats
"""
Solution for -> First character that repeats.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
[docs]
def first_dup(word: str) -> str | None:
"""
Find the first character that repeats in a String and return that character.
:param word: string
:return: string, None
"""
for char in word:
if word.count(char) > 1:
return char
return None