Skip to content
C

Longest Common Prefix

Easyjavapythonccppjavascript

Given a list of strings, find the longest prefix shared by every string. If there is no common prefix, the answer is the empty string.

Input Format

The first line contains an integer K, the number of strings. Each of the next K lines contains one string with no spaces.

Output Format

Print the longest common prefix. If it is empty, print an empty line.

Input (stdin)

Output

Run your code to see output here...