#C9894. Longest Common Prefix Length
Longest Common Prefix Length
Longest Common Prefix Length
Given a list of strings, determine the length of the longest common prefix shared among all the strings. The common prefix is defined as the initial contiguous sequence of characters that appears at the beginning of every string in the list. For instance, given the strings "flower", "flow", and "flight", the common prefix is "fl" which has a length of 2.
The input starts with an integer N, representing the number of strings, followed by N lines each containing one string. Your task is to compute and output the length of this common prefix.
All formulas in this problem, if any, should be rendered in (\LaTeX) format.
inputFormat
The first line contains a single integer (N) ((1 \leq N \leq 10^5)) that denotes the number of strings. Each of the following (N) lines contains a non-empty string composed of lowercase letters. The strings' lengths are at most (10^5) characters.
outputFormat
Output a single integer which represents the length of the longest common prefix among the given strings.## sample
3
flower
flow
flight
2