← 返回 amazon 的题目列表Find Longest Repeated Prefix in List of Words
类型:online_judge
amazon
Given a list of words, find the longest prefix that appears at least twice in the list.
Input:
words: A list of strings representing the words to search.
Output: Returns a string indicating the longest repeated prefix found. If there is no such prefix, return an empty string.
Example:
words = ["banana", "bandana", "banish", "banner", "bang", "bank"]
Output Example:
"ban"
Example
Input
banana
bandana
banish
banner
bang
bank