Skip to content

Instantly share code, notes, and snippets.

@ruliarmando
Created October 23, 2014 16:01
Show Gist options
  • Save ruliarmando/78a1792f358818ca110d to your computer and use it in GitHub Desktop.
Save ruliarmando/78a1792f358818ca110d to your computer and use it in GitHub Desktop.
cek dupe
from collections import Counter
def cek(string):
if len(string) >= 2:
dupe = 0
for i in Counter(string).most_common():
if i[1] >= 2: dupe += 1
if dupe >= 2: return True
return False
print cek('aaabbcdeg')
print cek('aaaaaaaaab')
print cek('absjedeo')
print cek('aaaabbbbbccccdd')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment