word = raw_input("Enter the word: ") counter = 0 letters = list(word) # coverts to a list of characters. # 'gene' becomes ['g','e','n','e'] letters.sort() # now identical letters are adjacent # above becomes ['e','e','g','n'] for i in range(len(word)-1): if letters[i]==letters[i+1]: counter = counter + 1 if counter>0: print "There are repeated letters" else: print "There are no repeated letters"