New update is available. Click here to update.

Longest Duplicate SubString

Posted: 10 Mar, 2021
Difficulty: Moderate


Try Problem

You are given a string 'S' and you need to return the length of the longest duplicate substring in the given string. The occurrence of duplicate sub-strings can overlap also.

If there are many longest duplicate sub-string return any of them.

Input Format
The first line of input contains an integer ‘T’ denoting the number of test cases.

The next ‘T’ lines represent the ‘T’ test cases.

The first and only line of the test case contains a single string 'S'.

Output format :

For each test case, print a single line containing a single integer denoting the length of the longest possible duplicate substrings.

The output of each test case will be printed in a separate line.


You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= T <= 50
1 <= length of string <= 200

Time limit: 1 sec.