Skip to content

Instantly share code, notes, and snippets.

@davidejones
Created August 24, 2016 19:43
Show Gist options
  • Select an option

  • Save davidejones/cac463724214fc5f7a6c5d46af5e4d4f to your computer and use it in GitHub Desktop.

Select an option

Save davidejones/cac463724214fc5f7a6c5d46af5e4d4f to your computer and use it in GitHub Desktop.
repeating characters checking
letters = 'aaaabbbbbbbcccddddddddeeeee'
data = {}
for letter in letters:
if letter in data:
data[letter] += 1
else:
data[letter] = 1
# which letter has the most repeating chars
l = max(data.iterkeys(), key=lambda k: data[k])
print(l)
# print out the repeating chars
print(l * data[l])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment