g | x | w | all
Bytes Lang Time Link
012Uiua240928T222347Znyxbird
006Vyxal240927T145404Zpacman25
052Zsh230309T153742Zroblogic
064Python 3230308T173224ZGulgDev
032Arturo230308T171855Zchunes
008Husk210429T111609ZRazetime
094Lua191122T143543ZLuaNoob
048C# Visual C# Interactive Compiler191114T181801ZMalivil
068APLNARS191121T184340Zuser5898
053Röda191120T214829Zfergusq
081Python 3191120T175321ZCello Co
5956Haskell191115T013723ZJoseph S
042Scala191114T194128ZLayman
nan191116T130852ZCzylabso
030Wolfram Language Mathematica191116T014857ZTraws
009Brachylog191115T231715ZUnrelate
053jq191115T220410Zwirefox
136SimpleTemplate191115T123900ZIsmael M
6010RPL191115T000243ZNacre
023Retina191114T152545Zthe defa
022J191114T112021ZGalen Iv
00705AB1E191114T090846ZKevin Cr
028Ruby191114T075233ZG B
062PHP191114T105942ZNight2
015APL Dyalog Unicode191114T084909ZBubbler
107Red191114T082752ZGalen Iv
034Perl 5 040n191113T191246ZNahuel F
014K ngn/k191113T205153Zscrawl
129C gcc191113T224239ZErikF
018PowerShell191114T005406Zmazzy
072Python 2191113T224551ZChas Bro
019Perl 6191113T223629ZJo King
037Retina 0.8.2191113T214446ZNeil
007Japt191113T205535ZAZTECCO
053PowerShell191113T190343ZAdmBorkB
028R191113T193756ZGiuseppe
008Jelly191113T181210ZNick Ken
009Pyth191113T183849Zfrank
050JavaScript191113T181222ZShaggy
053JavaScript ES6191113T180844ZArnauld
007Japt191113T180315ZShaggy

Uiua, 12 bytes

↘1⍚⊂°⊏⊕□≡◇⧻.

Try it!

↘1⍚⊂°⊏⊕□≡◇⧻.
        ⊕□   . # group input into boxes by
           ≡◇⧻ #   unboxed length
     °⊏        # get indices
  ⍚⊂          # and join to each group
↘1             # drop the first group (with length 0)

Vyxal, 48 bitsv2, 6 bytes

⁽Lġ‡@hZ

Try it Online!

Bitstring:

111000011101111110100110011110111101010000011000

Zsh, 52 bytes

for i;printf \ $i>>$#i;(for j (*)<<<$j`<$j`)|sort -n

Try it online!

For each argument/word i, append to a file called $#i (length of i).
For each resulting file j (*), print the filename <<<$j and contents <$j, and sort.

Python 3, 64 bytes

lambda x:{i:[*filter(lambda a:len(a)==i,x)]for i in range(1,11)}

Try it online!

Arturo, 32 bytes

$=>[gather arrange&=>size=>size]

Try it

Husk, 8 bytes

mṠ,oL←kL

Try it online!

so close..

Lua, 85 94 bytes

changed to to function format +9 bytes

r={}m=0 for j=1,#i do w=i[j]l=#w m=l>m and l or m c=r[l]r[l]=c and w..","..c or w end return r

Try it online!

C# (Visual C# Interactive Compiler), 48 bytes

a=>a.GroupBy(k=>k.Length,v=>v).OrderBy(g=>g.Key)

Try it online!

-1 byte thanks to @dzaima

-43 bytes if returning the raw grouping is allowed, thanks to @someone

-18 bytes by switching to the Visual C# Interactive Compiler

APL(NARS), chars 34, bytes 68

{a,⍨¨↑¨≢¨¨a←a⊂⍨≢¨a←a[⍋a←⍵⊂⍨' '≠⍵]}

test:

  f←{a,⍨¨↑¨≢¨¨a←a⊂⍨≢¨a←a[⍋a←⍵⊂⍨' '≠⍵]}
  ⎕fmt f 'Code Golf and coding challenges Meta'
┌4──────────────────────────────────────────────────────────────────────┐
│┌2───────┐ ┌4────────────────────────┐ ┌2──────────┐ ┌2───────────────┐│
││  ┌3───┐│ │  ┌4────┐ ┌4────┐ ┌4────┐│ │  ┌6──────┐│ │   ┌10─────────┐││
││3 │ and││ │4 │ Code│ │ Golf│ │ Meta││ │6 │ coding││ │10 │ challenges│││
││~ └────┘2 │~ └─────┘ └─────┘ └─────┘2 │~ └───────┘2 │~~ └───────────┘2│
│└∊───────┘ └∊────────────────────────┘ └∊──────────┘ └∊───────────────┘3
└∊──────────────────────────────────────────────────────────────────────┘
  ⎕fmt f 'My v3ry 3xc13nt m0th3r 53rv3d u5 pzz@5 #Ju'
┌6─────────────────────────────────────────────────────────────────────────────────────────┐
│┌3────────────┐ ┌2───────┐ ┌2────────┐ ┌2─────────┐ ┌3────────────────────┐ ┌2───────────┐│
││  ┌2──┐ ┌2──┐│ │  ┌3───┐│ │  ┌4────┐│ │  ┌5─────┐│ │  ┌6──────┐ ┌6──────┐│ │  ┌7───────┐││
││2 │ My│ │ u5││ │3 │ #Ju││ │4 │ v3ry││ │5 │ pzz@5││ │6 │ 53rv3d│ │ m0th3r││ │7 │ 3xc13nt│││
││~ └───┘ └───┘2 │~ └────┘2 │~ └─────┘2 │~ └──────┘2 │~ └───────┘ └───────┘2 │~ └────────┘2│
│└∊────────────┘ └∊───────┘ └∊────────┘ └∊─────────┘ └∊────────────────────┘ └∊───────────┘3
└∊─────────────────────────────────────────────────────────────────────────────────────────┘

Röda, 53 bytes

{a=new map;a[#_]+=_1 if[a[#_1]?]else a[#_1]=[_1];[a]}

Try it online!

Explanation

{a=new map;a[#_]+=_1 if[a[#_1]?]else a[#_1]=[_1];[a]}
{                                                   } anonymous function
 a=new map;                                           let a be a hash map
                                                      for each _1:
                     if[       ]else            ;     if
                        a[#_1]?                         a[length(_1)] exists
           a[#_]+=_1                                  then append _1 to a[length(_1)]
                                     a[#_1]=[_1]      else a[length(_1)] = [_1]
                                                 [a]  return a

Python 3, 81 bytes

Outputs a dictionary instead of a list or tuple:

lambda s:dict(sorted((len(x),list(filter(lambda y:len(y)==len(x),s)))for x in s))

Try it online!

Haskell, 59 56 bytes

l=length
f s=[(n,[x|x<-s,l x==n])|n<-[1..maximum$l<$>s]]

Try it online!

Scala, 30 42 bytes

Correction thanks to Value Ink

(s:String)=>s.split(" ").groupBy(_.length)

Try it online!

JULIA
Some 55 bytes:

H(l,L=length.(l))=sort([(v,l[L.==v]) for v in Set(L)])

Try it online

Wolfram Language (Mathematica), 30 bytes

KeySort@*GroupBy[StringLength]

Try it online!

Brachylog, 9 bytes

lᵍ{hl}ᶻ¹o

Try it online!

Takes input as a list of words (the testing header converts from space-separated for convenience). Output is as a list of pairs [length,words], sorted in ascending order of length. Two alternative solutions of the same length, lᵒlᵍ{hl}ᶻ and lᵍ{hl}ᶻtᵒ, output pairs reversed.

jq, 53 bytes

map({l:length,s:.})|group_by(.l)|.[]|[.[0].l,[.[].s]]

Try it online!

SimpleTemplate, 136 bytes

Yeah, it's a long one... The order of the output is what made it longer :/

{@setM 0}{@eachargv.0}{@callstrlen intoR _}{@setL.[R]L.[R],_}{@ifM is lowerR}{@setM R}{@/}{@/}{@forfrom 1toM}{@echo_}.{@echojl" " L.[_]}

Incredibly, it is easier (and shorter) to output that to return.

You can try it on http://sandbox.onlinephpfunctions.com/code/ec4bf4b3efa93c63c6c5c9f1458330da0178b6cd
(Line 974 has the words, line 976 has the golfed/ungolfed version variable)


Ungolfed:

{@set results}
{@set max 0}
{@each argv.0 as word}
    {@call strlen into length word}
    {@set results.[length] results.[length], word}
    {@if max is lower than length}
        {@set max length}
    {@/}
{@/}
{@for i from 1 to length}
    {@echo i}.{@echo separator " " results.[i], "\n"}
{@/}

Most of it should be easy to understand.

RPL, 60+10 bytes

Let's explore more creative output formats:

DUP«SIZE»DOLIST SWAP 2«STR→ X ROT ^ *»DOLIST ΣLIST EXPANDMOD

turns the list {"Code" "Golf" "and" "Coding" "Challenges" "Meta"} into the polynomial Challenges·X10+Coding·X6+(Code+Golf+Meta)·X4+and·X3 thanks to EXPANDMOD.

Sadly to allow exotic names like pizz@5 – just for you to know, @ introduces comments – STR→ must be replaced by #5B15h SYSEVAL adding 10 bytes to the source code, and obfuscating the call. That does however allow printable and even non printable chars, the latters only displayed as black squares but not lost. So the garbage resistant code is

DUP«SIZE»DOLIST SWAP 2«#5B15h SYSEVAL X ROT ^ *»DOLIST ΣLIST EXPANDMOD

(EXPANDMOD is present in HP50g at least. Tested with Emu48 in 50g mode. The code page is documented here).

Retina, 31 27 23 bytes

Takes input as a newline-separated list of words (I haven't noticed that's allowed at first).

.+
$.& $&
N`
D`\d+
¶ 
 

I'll add the explanation later (for now, the previous revision's explanation without the first line works perfectly). Try it online!

J, 22 bytes

-2 bytes thaks to FrownyFrog

If the output can be a table with some empty boxes:

[:/:~#@>(,~#&.>@{.)/.]

Try it online!

J, 24 bytes

/:~@(#@><@(#@>@{.;])/.])

Try it online!

Just made it work - no doubt it can be golfed further.

05AB1E, 9 7 bytes

€gêεùy‚

-2 bytes thanks to @Grimy.

Outputs a list of lists from lowest to highest, with the label at the right side instead of left. I.e. [[["and"],3],[["Code","Golf","Meta"],4],[["Coding"],6],[["Challenges"],10]].

Try it online or verify all test cases.

Explanation:

€g       # Get the length of each string in the (implicit) input-list
  ê      # Sort and uniquify this list of lengths
   ε     # Map each length `y` to:
    ù    #  Keep strings from the (implicit) input-list equal to this length
     y‚  #  And pair it with the current length `y`
         # (after which the result is output implicitly)

Ruby, 22 28 bytes

->w{w.group_by(&:size).sort}

Try it online!

PHP, 62 bytes

for(;$w=$argv[++$i];ksort($a))$a[strlen($w)][]=$w;print_r($a);

Try it online!

APL (Dyalog Unicode), 15 bytes

(⍋⊃¨⊂)≢¨{⊂⍺⍵}⌸⊢

Try it online!

APL is not particularly good at simply sorting.

How it works

(⍋⊃¨⊂)≢¨{⊂⍺⍵}⌸⊢
      ≢¨     ⌸⊢  Group the arg's elements by their lengths
        {⊂⍺⍵}    Wrap each list of items, paired with the length
(⍋⊃¨⊂)           Idiom for sorting:
 ⍋               Grade up; gives indexes that will make the array sorted
  ⊃¨⊂            Map the indexes to the items

Red, 107 bytes

func[a][m: copy#()foreach w sort a[k: length? w
unless m/:k[put m k copy[]]append m/:k w]sort/skip to[]m 2]

Try it online!

Perl 5 (-040n), 45, 40, 34 bytes

-5 bytes thanks to Xcali

$a[y///c].=" $_"}{say$b++,$_ for@a

Try it online!

K (ngn/k), 12 14 bytes

{x@=#'x@:<#'x}

Try it online!

this returns a k dictionary. lengths are key, words are value. let me know if this output format is acceptable.

in q (wrapper around the k4 dialect), we can evaluate using the k interpreter and get q output formatting:

q)k){x@=#:'x@:<#:'x}("Code"; "Golf"; "and"; "Coding"; "Challenges"; "Meta")
3 | ,"and"
4 | ("Meta";"Golf";"Code")
6 | ,"Coding"
10| ,"Challenges"

note the extra colons, which aren't required for "eached" monads in the ngn implementation

C (gcc), 147 129 bytes

Thanks to girobuz and ceilingcat for the suggestions.

This routine first finds the maximum string length of an input array of strings, then prints the words by length in reverse.

m,*t;f(int**s){for(t=s;*s;m=fmax(m,strlen(*s++)+1));for(;--m;)for(printf("\n%d",m),s=t;*s;)printf(" %s"+3*(strlen(*s++)!=m),*s);}

Try it online!

PowerShell, 18 bytes

$args|group Length

Try it online!

Python 2, 76 74 72 bytes

lambda a:sorted((l,[d for d in a if len(d)==l])for l in set(map(len,a)))

Try it online!

Perl 6, 19 bytes

*.classify(*.chars)

Try it online!

Pretty much does exactly as asked.

*.classify(       )  # Classify the list
           *.chars   # By number of characters

Retina 0.8.2, 37 bytes

S` 
.+
$.& $&
O#`
r`(?<=\1.+)¶(.+ )
 

Try it online! Explanation:

S` 

Split the input on spaces.

.+
$.& $&

Precede each word by its length.

O#`

Sort numerically.

r`(?<=\1.+)¶(.+ )
 

If two lines start with the same length, delete the newline and the length.

Japt, 7 bytes

üÊ®uZÎl

Try it

üÊ®uZÎl // input as array of words
üÊ // group by length
  ® // for each group
   uZÎl // append length of 1st word

PowerShell, 63 53 bytes

$a=@{};$args|%{$a[$_.length]+=" $_"};$a|% *or|sort N*

Try it online!

(-10 bytes thanks to mazzy)

Takes arguments via splatting, which on TIO manifests as separate command-line arguments.

We first construct an empty hashtable $a, then loop through the input arguments. Each item is tacked onto $a in the appropriate $_.length slot. Then comes the lengthy .GetEnumerator() followed by a sort to get the hashtable to print out in order. That's left on the pipeline and output is implicit.

R, 28 bytes

split(w<-scan(,""),nchar(w))

Try it online!

split does the trick; results in a list() where the element names are the lengths and the elements are vectors containing the words.

Jelly, 6 8 bytes

ẈẈḢ,Ɗƙ⁸Ṣ

Try it online!

A monadic link which takes a list of Jelly strings and returns a list of lists where the first member of each list is the length and the second is a list of Jelly strings of that length. Plus 2 bytes now it’s been clarified that ordering of the list is mandatory.

Pyth, 9 bytes

m+lhdd.gl

Try it online!

Port of @Shaggy's answer, so I cant really take credit for this (lol)

Pyth, 14 bytes

m+dfqdlTQSleol

Try it online!

Saves a few bytes by mapping a filtered list to each number in a 1-indexed range. This only saves 2 bytes due to the fact that the last two bytes can be implicit (would be m+dfqdlTQSleolNQ otherwise)

How it works

m+dfqdlTQSleol
m              - Map
 +d            - The sum of the element and...
   fqdlTQ      - The filtered input where each element of the input is length d        
         Sl    - To the range [1, length]
           eol - of the last element of the ordered list by key=length
               - Print implicitly

Pyth, 16 bytes

FkSleolNQkfqklTQ

Try it online!

16 bytes seems a bit high for a challenge like this but oh well. Would be 14 bytes but it looks like the last 2 bytes cant be implicit due to how filter works in pyth

How it works

FkSleolNQkfqklTQ
Fk                 - For k in...
  Sl               - The range [1, length]
    eolN           - Of the last element of the sorted list by key=length
        Q          - Of the input
         k         - Print k
          fqklT    - Filter by key k == length...
               Q   - The input (prints implicitly)

Sorry if this answer is too long, I can cut it a bit if needed

JavaScript, 50 bytes

Input as an array of words, output as an object where the keys are the word lengths and the values are arrays of words.

a=>a.map(w=>o[l=w.length]=[...o[l]||[],w],o={})&&o

Try it Online!

JavaScript (ES6), 53 bytes

Takes input as a list of words. Returns an object whose keys are the lengths and whose values are the lists of corresponding words.

a=>a.map(w=>(o[n=w.length]=o[n]||[]).push(w),o={})&&o

Try it online!

Japt, 7 bytes

Input as an array of words, output as a 2D-array.

üÊËiDÎÊ

Try it

üÊËiDÎÊ     :Implicit input of array
ü           :Group and sort by
 Ê          :  Length
  Ë         :Map each sub-array D
   i        :  Prepend
    DÎÊ     :    Length of first element of D