Group(), Groups() & Groupdict()

  • + 0 comments
    • inpt = input()
    • l = []
    • res = []
    • p = []
    • last = []
    • for i in inpt:
    • if i.isalnum():
    • l.append(i)
    • for i in range(len(l)-1):
    • if l[i] == l[i+1]:
    • res.append(i)
    • res = list(map(str,res))
    • for rev in res:
    • b = reversed(rev)
    • p.append(''.join(b))
    • for i in range(len(res)-1):
    • if res[i] == p[i]:
    • last.append(res[i])
    • if len(last) >0:
    • print(last[0][0])
    • elif len(last) == 0:
    • print(-1)
    • *