I don`t undestand where my mistake?

CODE:

def func(text):

t = text.lower()
a = ''
for i in t:
if i.isalpha():
a += i
dct = {}
for i in a:
if i in dct:
dct[i] += 1
else:
dct[i] = 1
count = 0
for i in dct:
if dct[i] == 1:
count += 1
b = (list(dct.items()))
c = sorted(b, key = lambda x: (x[-1], x[0]))
if count == len(dct):
return sorted(text)[0]
else:
return c[-1][0]

Created at: 2016/01/28 21:15; Updated at: 2016/01/28 22:13