If the input is 'red blue green yellow', which of the following outputs shows the colors sorted by length of the word?

Answer: B. blue red green yellow
The colors are sorted by length: blue (4), red (3), green (5), yellow (6).