Suffix subset
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 256 megabytes
You are given a set of rows (s_1, s_2, ..., s_n).
Your task is to find a subset of these rows that satisfies the following conditions:
There exists a row (t) such that every row in the subset is a suffix of (t).
The subset contains the maximum possible number of rows.
Your goal is to determine and output the number of rows in this subset.
Input
The first line contains an integer (n) ((1 n 10^5)), representing the number of rows in the set. Each of the next (n) lines contains a non-empty row (s_i). All rows consist solely of lowercase Latin letters. The total length of all rows combined does not exceed (10^5).
Output
Output a single integer, which is the number of rows in the subset that meets the specified conditions.
Examples
Input #1
Answer #1
Submissions 20
Acceptance rate 50%