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.
Kontakt
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.