6

Hi guys I am having problems with finding the longest word available in WordList["English"] I have found that the longest word has 24 characters thanks to this line

Max[StringLength[WordList[]]]

but I don't know how to find the position of the word Knowing her length. I thought I need some selection rule but I fail to implement it. any help?

Alucard
  • 2,639
  • 13
  • 22

1 Answers1

8

ok one solution I found, aside the one given by Kuba , is

length = Max[StringLength[WordList[]]]
Select[WordList[], StringLength[#] == length & ]

a second solution with the function Pick[] is

Pick[WordList[], StringLength[WordList[]], length]

A third one with Cases[]

f = StringLength[#] == 24 &;
Cases[WordList[], x_ /; f[x]]

a BarChart with the absolutetiming:

absolute timing of the different functions

Alucard
  • 2,639
  • 13
  • 22