import_code("/home/me/projects/lzw/libs/lst.src") import_code("/home/me/projects/lzw/libs/safemap.src") import_code("/home/me/projects/lzw/lzw.src") import_code("/home/me/projects/lzw/encoder.src") input = user_input("in: ") compressed = Lzw.compress(input) //compressed = Lzw.compress("TOBEORNOTTOBEORTOBEORNOT") //compressed = Lzw.compress("ffffffffffffffffffffffff") //print "compressed: " + compressed e = Encoder.encode(compressed) print "encoded: " + e dd = Lzw.decompress(Encoder.decode(e)) //print "decoded and decompressed: " + dd if input != dd then exit("<color=red>ERROR</color>") print "input len: " + input.len print "encoded len: " + e.len print "text reduced by: " + round(100 - (e.len / input.len * 100), 2) + "%" //print input //print dd //print input == dd