You are given
n strings
ti. Each string has cost
ci.
Let's define the function of string
, where
ps,i is the number of occurrences of
s in
ti,
|s| is the length of the string
s. Find the maximal value of function
f(s) over all strings.
Note that the string
s is not necessarily some string from
t.
Output
Print the only integer
a − the maximal value of the function
f(s) over all strings
s. Note one more time that the string
s is not necessarily from
t.