Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
25
Task/ABC-problem/Pluto/abc-problem.pluto
Normal file
25
Task/ABC-problem/Pluto/abc-problem.pluto
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
function r(word, bl)
|
||||
if word == "" then return true end
|
||||
local c = word:byte(1) | 32
|
||||
for i = 1, #bl do
|
||||
local b = bl[i]
|
||||
if c == b:byte(1) | 32 or c == b:byte(2) | 32 then
|
||||
bl[i] = bl[1]
|
||||
bl[1] = b
|
||||
if r(word:sub(2), bl:slice(2)) then return true end
|
||||
bl[1], bl[i] = bl[i], bl[1]
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function new_speller(blocks)
|
||||
local bl = blocks:split(" ")
|
||||
return |word| -> r(word, bl)
|
||||
end
|
||||
|
||||
local sp = new_speller("BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM")
|
||||
local words = {"A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"}
|
||||
for words as word do
|
||||
print(string.format("%-7s %s", word, sp(word)))
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue