blob: eed8169a4447957fa440ff770eb41e1f99a05fa3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
def first_non_repeating_character(str1):
char_order = []
ctr = {}
for c in str1:
if c in ctr:
ctr[c] += 1
else:
ctr[c] = 1
char_order.append(c)
for c in char_order:
if ctr[c] == 1:
return c
return None
|