Created
October 23, 2014 16:30
-
-
Save ruliarmando/3d033a4c3ffebd28c696 to your computer and use it in GitHub Desktop.
cek string version 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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