#C3587. Longest Common Prefix

    ID: 47030 Type: Default 1000ms 256MiB

Longest Common Prefix

Longest Common Prefix

Given an array of strings, determine the longest common prefix among these strings. If there is no common prefix, return an empty string. This problem requires you to consider various edge cases, such as when the input list is empty or when one or more strings are empty.

The input is provided via standard input, and the output should be written to standard output. The first line of input contains an integer \( n \) representing the number of strings, followed by \( n \) lines where each line contains a string. Your task is to compute the longest common prefix shared by the input strings. If no common prefix exists, output an empty string.

inputFormat

The first line contains an integer \( n \), representing the number of strings. The next \( n \) lines each contain one string.

outputFormat

Output a single line containing the longest common prefix among the given strings. If there is no common prefix, output an empty string.

## sample
3
flower
flow
flight
fl