in reply to Seeking the longest string in an array

That's not O(N2). /$a/ involves some serious looping. Probably O(M2). So O(N2*M2) total
N = number of words.
M = length of word.