Python - Bytes: 44354422, False +ves: 0, False -ves: 0 = Score: 44354422
import base64,zlib,sys;T=eval(zlib.decompress(base64.b64decode("eNqdXEt24zgMPE42Wsx6bjDHUEzaVpv6DEU7Uc/L3aftdkgCVaA8k0Ve4o9EgmChUAD1z9tfb3/+8/b25x9f3Vv//LN7O9z/ivdf8/3Xmn/dP/jrp3tL+bPD/a/b/dfjr8cbW/ls9+arL/769z1f9po//3i3+30VL+7j7v+56jOn+999vt1U3ynm73s6gO73fZ9XOuZJlss5nKTPH8uvD/Kl7m3M1igTm+TsHl8M938/8i03tGuZQp/Hs5GLVNOZxISfFsoXnPLQnPpIhJWa85DPdOa/PrLmGRC7bPleKVt0hOU4y8U7yRuQKf1+Y7n/u0jzxPq6Ab1nzQO6VKsV87geb236reLR8mo+f6WvvpLUcpTFd3ICxd2veQATrlWq55SkRR/3fWzOi7y28ql8xUN+/SLn8zRXqF5QnkLMuZSprvpyMX9b+VVtt3JNAinHbJqAEKCM/ZzZGdcnZhtSkJBmLrs/1Fa/su2hdv7BsBHi31kOpsYNsOKUL+015nmEoINcWOlMoXbBGlgmNaeynRa9aCveeM4TOcDOPmRoD/maCbby90VWssnL97SDdBWcvAO6SzToqjnWUSXiTGAF1O56OoMjaPG92Of8ntdOnW/T61D3cPYji1ffM510fBmzdUXQey+zroLAIq3iwb2t2FZcOpH1OeYxqH32TrfDF3FFgZMGgB9I7JzFwnQIXU5ykIGZq6xasfEVF6DFL2aNUBibIgahpKEy2pOtoZhcrxhuhaUVEaQjGGZvhyi33rm+7KbWjqD3tQaQmuUVJ3RsHYQbs/j2fKsOKI6QHSugXTTcXqSDI0tV25qF/gpprtLheBD7UpDkdSBQOD3nX6NcvBN3TLUtpTOX+HMDfxkoWdG2fK76R/3NVXJmb6cI+W8KOV3FJml4GtB/AHgdpT+SMEBArXkQJVadhoauGqYD4gx++6Hs5zD8sM0hLee08w/azWd934lys+JYYh0dX5TJ3A7P/4O+Cbjr0wD1UCsc+dTjYx5aE6IzhkiX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1]:
C=c.lower()
if c in t:t=t[c]
elif f and C in t:f=0;t=t[C]
else:sys.exit(1)
if""notprint inFalse
print""in t:sys.exit(1)
This is a python program that expects one command line argument, the word
. From the list of words I constructed a trie, zlib'ed the argument and finally encoded it with base64. If the word is in the trie, the program exits with statusprints 0True
, otherwise it exits with statusprints 1False
. I wanted to create a spell checker that has 100% accuracy. Also, I am abusing the fact, that if python does not have a final sys.exit()
call, the exit status is 0
.
$python check.py colour
$echo $?
0True
$python check.py Colour
$echo $?
0True
$python check.py coLoUr
$echo $?
1False
$python check.py color
$echo $?
1False
$python check.py Color
$echo $?
1False
$python check.py I
$echo $?
0True
$python check.py i
$echo $?
1False
import base64, zlib, sys
TRIE = eval(zlib.decompress(base64.b64decode("eNqdXEt24zgMPE42Wsx6bjDHUEzaVpv6DEU7Uc/L3aftdkgCVaA8k0Ve4o9EgmChUAD1z9tfb3/+8/b25x9f3Vv//LN7O9z/ivdf8/3Xmn/dP/jrp3tL+bPD/a/b/dfjr8cbW/ls9+arL/769z1f9po//3i3+30VL+7j7v+56jOn+999vt1U3ynm73s6gO73fZ9XOuZJlss5nKTPH8uvD/Kl7m3M1igTm+TsHl8M938/8i03tGuZQp/Hs5GLVNOZxISfFsoXnPLQnPpIhJWa85DPdOa/PrLmGRC7bPleKVt0hOU4y8U7yRuQKf1+Y7n/u0jzxPq6Ab1nzQO6VKsV87geb236reLR8mo+f6WvvpLUcpTFd3ICxd2veQATrlWq55SkRR/3fWzOi7y28ql8xUN+/SLn8zRXqF5QnkLMuZSprvpyMX9b+VVtt3JNAinHbJqAEKCM/ZzZGdcnZhtSkJBmLrs/1Fa/su2hdv7BsBHi31kOpsYNsOKUL+015nmEoINcWOlMoXbBGlgmNaeynRa9aCveeM4TOcDOPmRoD/maCbby90VWssnL97SDdBWcvAO6SzToqjnWUSXiTGAF1O56OoMjaPG92Of8ntdOnW/T61D3cPYji1ffM510fBmzdUXQey+zroLAIq3iwb2t2FZcOpH1OeYxqH32TrfDF3FFgZ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KO8ezNxCbHbe/igz12tD8+l5v93EmRB/lohuyQ8IfM2+fm9qZPVivSIfTzARq6i20XOi9bOPAEt5r9uF9vnUXntmMpiw7ag37oE2vEerj0e1uV3IkcBu51FcnspkrplP7/ffHmQzPlEWmqfLakhy9LyWN5seLEglTa9Mt0it568YVDXSqsuZPM5Nc/UzxcaBukJ48fRcpMdNdkUl+Vg7pUYnLj/GxjNV8DgbPZpX54rMP2PjdMFsOSgLv0h6g1XT1odBN3r495XHFrWedCVPhvc08LHWKusxJWrzFKeThLejFvtJzjQLM9fp3L/lTHxo")))
trie = TRIE
first = True
for character in sys.argv[1]:
CHARACTER = character.lower()
if character in trie:
trie = trie[character]
elif first and CHARACTER in trie:
first = False
trie = trie[CHARACTER]
else:
sys.exit(1)print False
if "" not in trie:
sys.exit(1)print False
sys.exit(0)print True