#Python, 158 bytes
Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
#Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
#Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
#Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
#Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
#Python, 70158 bytes
def g(s):import collections as c
f=lambda x:c,re;l=c.Counter(xre.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
fg("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome
#Python, 70 bytes
import collections as c
f=lambda x:c.Counter(x.split()).most_common(1)
Takes its input like this:
f("Bird is the word")
#Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]
Takes its input like this:
g("Bird is the word")
Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome