Skip to content

Instantly share code, notes, and snippets.

@ruliarmando
Created October 23, 2014 16:30
Show Gist options
  • Save ruliarmando/3d033a4c3ffebd28c696 to your computer and use it in GitHub Desktop.
Save ruliarmando/3d033a4c3ffebd28c696 to your computer and use it in GitHub Desktop.
cek string version 2
from collections import Counter
def cek(string):
if len(string) >= 2:
return True if sum([1 for i in Counter(string).most_common() if i[1] >= 2]) >= 2 else False
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