I read of a job interview question to write some code for the following:
Write an efficient function to find the first nonrepeated character in a st
def non_repeating(given_string):
try:
item = [x for x in given_string[:] if given_string[:].count(x) == 1][0]
except:
return None
else:
return item
# NOTE: The following input values will be used for testing your solution.
print non_repeating("abcab") # should return 'c'
print non_repeating("abab") # should return None
print non_repeating("aabbbc") # should return 'c'
print non_repeating("aabbdbc") # should return 'd'