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 5% | |
#2 | 36 c. | Top 15% | |
#3 | 37 c. | Top 30% | |
#4 | 38 c. | Top 35% | |
#5 | 39 c. | Top 40% | |
#6 | 71 c. | Top 45% | |
#7 | 75 c. | Top 50% | |
#8 | 77 c. | Top 55% | |
#9 | 79 c. | Top 70% | |
#10 | 81 c. | Top 75% | |
#11 | 84 c. | Top 85% | |
#12 | 99 c. | Top 90% | |
#13 | 150 c. | Top 95% | |
#14 | 398 c. | Top 100% |