Skip to content

Instantly share code, notes, and snippets.

@hilbix
Created August 10, 2026 12:26
Show Gist options
  • Select an option

  • Save hilbix/22816af649fb44c5d9c1345e67b51007 to your computer and use it in GitHub Desktop.

Select an option

Save hilbix/22816af649fb44c5d9c1345e67b51007 to your computer and use it in GitHub Desktop.
Is "bekloppt" really the greatest word of German, which is sorted alphabetically?
#!/bin/bash
gawk '
BEGIN {
s=0;
for (x=60; ++x<=122; s++)
nr[sprintf("%c", x)] = s;
}
{
x=tolower($0);
l="";
s=0;
do
{
c = substr(x,0,1)
if (c < l) next;
s += nr[c];
l = c;
x = substr(x,2)
} while(x != "");
print length($0) " " s " " $0
}
' /usr/share/dict/* |
sort -u | sort -n
@hilbix

hilbix commented Aug 10, 2026

Copy link
Copy Markdown
Author
$ ./abcwords.sh | tail
7 317 abbisst
7 317 beeilst
7 319 abfloss
7 322 beehrst
7 332 begosst
7 336 beirrst
7 343 billowy
8 370 beginnst
8 374 abflosst
8 377 bekloppt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment