A sequence of words over alphabet is given. The length of longest word occuring as a coherent fragment in every word given is to be found.
Task
Write a program which:
reads the sequence of words from the standard input,
counts the length of the longest word occuring as a coherent fragment in every word given,
writes the result to the standard output.
Input
In the first line of the standard input there is an integer , where is the number of words. In each of the next lines there is one word formed from small letters of English alphabet . The length of each word is at least , but not greater than .
Output
The text of standard output should consist of exactly one line containing a single integer equal to the length of the longest word occuring as the coherent fragment in every word given.
Example
For the input data:
3
abcb
bca
acbc
the correct result is:
2
Task author: Adam Malinowski.
Send Feedback
In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.