Find the longest common prefix string amongst an array of strings.
Write a program that takes an array of lowercase strings and returns the longest common prefix (LCP) that is shared amongst all strings. If there is no common prefix, return an empty string. The words are separated by a space character.
# | Size | % | Users |
---|---|---|---|
#1 | 32 c. | Top 4% | |
#2 | 36 c. | Top 13% | |
#3 | 37 c. | Top 25% | |
#4 | 38 c. | Top 29% | |
#5 | 39 c. | Top 33% | |
#6 | 67 c. | Top 38% | |
#7 | 71 c. | Top 42% | |
#8 | 75 c. | Top 46% | |
#9 | 77 c. | Top 50% | |
#10 | 79 c. | Top 63% | |
#11 | 81 c. | Top 71% | |
#12 | 84 c. | Top 79% | |
#13 | 87 c. | Top 83% | |
#14 | 99 c. | Top 88% | |
#15 | 150 c. | Top 92% | |
#16 | 398 c. | Top 96% | |
#17 | 433 c. | Top 100% |