Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Anagrams/Picat/anagrams-1.picat
Normal file
12
Task/Anagrams/Picat/anagrams-1.picat
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
go =>
|
||||
Dict = new_map(),
|
||||
foreach(Line in read_file_lines("unixdict.txt"))
|
||||
Sorted = Line.sort(),
|
||||
Dict.put(Sorted, Dict.get(Sorted,"") ++ [Line] )
|
||||
end,
|
||||
MaxLen = max([Value.length : _Key=Value in Dict]),
|
||||
println(maxLen=MaxLen),
|
||||
foreach(_Key=Value in Dict, Value.length == MaxLen)
|
||||
println(Value)
|
||||
end,
|
||||
nl.
|
||||
6
Task/Anagrams/Picat/anagrams-2.picat
Normal file
6
Task/Anagrams/Picat/anagrams-2.picat
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
go2 =>
|
||||
M = new_map(),
|
||||
_ = [_:W in read_file_lines("unixdict.txt"),S=sort(W),M.put(S,M.get(S,"")++[W])],
|
||||
X = max([V.len : _K=V in M]),
|
||||
println(maxLen=X),
|
||||
[V : _=V in M, V.len=X].println.
|
||||
Loading…
Add table
Add a link
Reference in a new issue