Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,32 @@
func isordered w$ .
for c$ in strchars w$
if strcode c$ < prev
return 0
.
prev = strcode c$
.
return 1
.
repeat
w$ = input
until w$ = ""
if len w$ >= max and isordered w$ = 1
max = len w$
words$[] &= w$
.
.
for w$ in words$[]
if len w$ = max
write w$ & " "
.
.
#
# the content of unixdict.txt
input_data
10th
abacus
abbot
abbott
accent
floppy
flora

View file

@ -0,0 +1,8 @@
def 'str is-ordered' [] {
split chars | window 2 | all { $in.0 <= $in.1 }
}
open 'unixdict.txt' | lines
| group-by { str length } | sort -n -r
| values | each { filter { str is-ordered } }
| skip while { is-empty } | first

View file

@ -0,0 +1,19 @@
uses System.Net;
function IsOrderedWord(w: string): boolean;
begin
result := true;
for var i := 2 to w.Length do
begin
if w[i] < w[i - 1] then result := false
end;
end;
begin
var client := new WebClient();
var text := client.DownloadString('http://wiki.puzzlers.org/pub/wordlists/unixdict.txt');
var words: sequence of string := text.ToWords(|#10, #13|);
words := words.Where(x -> IsOrderedWord(x));
var maxlen := words.Max(x -> x.Length);
words.Where(x -> x.length = maxlen).Println;
end.