[BOJ 8053] Repetitions

View as PDF

Submit solution

Points: 4
Time limit: 3.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

A sequence of words over alphabet [‘a’,…,’z’] is given. The length of longest word occuring as a coherent fragment in every word given is to be found.</p>

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.
## 입력 형식

In the first line of the standard input there is an integer n, where 1 ≤ n ≤ 5 is the number of words. In each of the next n lines there is one word formed from small letters of English alphabet [‘a’,…,’z’]. The length of each word is at least 1, but not greater than 2,000.

출력 형식

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.

예제 입력

3
abcb
bca
acbc

예제 출력

2

Comments

There are no comments at the moment.