1def first_non_repeating_character(str1):
2 char_order = []
3 ctr = {}
4 for c in str1:
5 if c in ctr:
6 ctr[c] += 1
7 else:
8 ctr[c] = 1
9 char_order.append(c)
10 for c in char_order:
11 if ctr[c] == 1:
12 return c
13 return None
14
15print(first_non_repeating_character('abcdef'))
16print(first_non_repeating_character('abcabcdef'))
17print(first_non_repeating_character('aabbcc'))
18
19