# Find the longest word in an array

Your challenge is to take an array of strings and output the longest string in the array. So for

["tiny", "small", "bigger", "biggest"]


the output would be biggest.

If two elements of the array have the same length, you should choose the one that appears first in the array. That means if the array looks like this:

["one", "two", "no"]


the output is one, but if the array looked like this:

["two", "one", "no"]


the output is two.

As this is , the shortest code in bytes wins.

• 2 notes: 1 It's heavily discouraged if the question is changed and invalidates existing answer, and 2 the Sandbox exists for exactly that reason (make sure challenges are good before posting) – user202729 Dec 20 '17 at 10:54
• Since I don't think anyone else has mentioned it -- Hi, and welcome to PPCG! – AdmBorkBork Dec 20 '17 at 14:21
• No you don't have to handle the case where the array is empty. But if you want you can. – Doggo Dec 20 '17 at 14:25
• 2 hours? That's far, far too quick to be accepting an answer. – Shaggy Dec 20 '17 at 15:05
• Normally you wait a week – Christopher Dec 20 '17 at 16:43

proc c a\ b {expr [string le $a]<[string le$b]}
proc L l {return [lindex [lsort -c c $l] 0]}  Try it online! Quite disappointed by the score, should/could be better. Thought about this one-proc version: proc L l { set m [lmap e$l {regsub -all . $e 1}] return [lindex$l [lsearch $m [expr max([join$m ,])]]]