Assume that we have some efficient way of creating a suffix tree of a string. Then I'm interested in efficient ways of finding:
Length of longest repeated substring. Given some string $S$, then a repeated substring is a substring $R$ of $S$ that occurs more than once in $S$. Then I wish to find the length of the longest repeated substring.
Example. Consider the string
yabbadabbado, then the substring
abbad occurs twice and is the longest repeated substring, so the answer would be $5$.
I'm also interested in the similar problem by shared substring of two strings.
Length of longest common substring. Given strings $S_1$ and $S_2$ then a substring is a common substring if it is a substring of both $S_1$ and $S_2$. I wish to find the length of the longest common substring.
Example. Given strings
boom have longest common substring of
oom and hence the answer would be $3$.
How can these be found efficiently?