Created
October 23, 2014 16:01
-
-
Save ruliarmando/78a1792f358818ca110d to your computer and use it in GitHub Desktop.
cek dupe
This file contains 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: | |
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