Skip to content

Instantly share code, notes, and snippets.

@khayyamsaleem
Created December 17, 2018 05:41
Show Gist options
  • Save khayyamsaleem/be5f5fcc7bf50ff6b6d495f16298e4b2 to your computer and use it in GitHub Desktop.
Save khayyamsaleem/be5f5fcc7bf50ff6b6d495f16298e4b2 to your computer and use it in GitHub Desktop.
counts = [ 0 for _ in range(26)]
for c in input('enter a string: '):
counts[ord(c) - 97] += 1
out = "".join([ chr(x+97) + str(y) for x,y in enumerate(counts) if y != 0])
print(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment