Lua code golf problem -
i've been playing around code golf problem: https://www.spoj.pl/shorten/problems/kamil/
i've got solution down 55 characters:
l in io.lines()do print(2^#l:gsub("[^tdlf]",""))end
now, shortest submitted solution in lua 47 characters long. can't figure out how further reduce mine , it's been driving me crazy. have hint me? i've tried working on io.read("*a") rid of loop didn't help.
lua (54 chars)
repeat print(2^#io.read():gsub('[^tdlf]',''))until nil
errors on completion, maybe not ok
otherwise spent while experimenting second return of gsub; seem gain 1 character return selecting.
Comments
Post a Comment