#K64367. Longest Common Prefix

    ID: 31960 Type: Default 1000ms 256MiB

Longest Common Prefix

Longest Common Prefix

Given an array of strings, your task is to find the longest common prefix string amongst them. If there is no common prefix, output an empty string. The prefix must be exactly the starting characters that are common in all strings.

Note: The input will be given via standard input (stdin) and the output should be printed to standard output (stdout).

Example:

Input:
3
flower
flow
flight

Output: fl

</p>

inputFormat

The input is provided via standard input. The first line contains an integer n representing the number of strings. The following n lines each contain a single string.

outputFormat

Output the longest common prefix shared by all the strings. If there is no common prefix, output an empty string.

## sample
3
flower
flow
flight
fl