We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
c = set(s)
l = []
result = "YES"
for i in c:
k = s.count(i)
l.append(k)
if(max(l) == min(l)):
return result
if(max(l)-min(l)== 1):
if(l.count(min(l))<2 or l.count(max(l))<2):
return result
else:
result = "NO"
return result
if(min(l) == 1 and l.count(min(l)==1) and l.count(max(l))==len(l)-1):
return result
else:
result = "NO"
return result
Sherlock and the Valid String
You are viewing a single comment's thread. Return to all comments →
def isValid(s):