import sys
from collections import Counter, OrderedDict


class OrderedCounter(Counter, OrderedDict):
    pass
first = next
with open(sys.argv[1], 'r') as test_cases:
    for test in test_cases:
        lettfreq = OrderedCounter(test)
print(first(l for l in lettfreq if lettfreq[l] == 1))
Regular Expression Matching First Non-Repeated Character