def hard_dedupe(s):
    """Takes in a string, and returns a string where only the first occurrence of each letter is retained. So the string 'abccba' goes to 'abc'. The empty string returns the empty string."""
    seen = set()
    ans = ''
    for char in s:
        if char in seen:
            continue
        seen.add(char)
        ans += char
    return ans