Skip to content

Latest commit

 

History

History

pro-longest-common-substring

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Longest Common Substring

Task:

Given multiple words, you need to find the longest string that is a substring of all words.

Input Format:

A string of words, separated by spaces. The string can also contain numbers.

Output Format:

A string, representing the longest common substring. If there are multiple longest common substrings, output the smallest one in alphabetical order.

Sample Input:

SoloLearn Learning LearningIsFun Learnable

Sample Output:

Learn

Explanation:

Learn is the longest common substring for the words SoloLearn Learning LearningIsFun Learnable.