SP694 DISUBSTR - Distinct Substrings

Description

Given a string, we need to find the total number of its distinct substrings.

Input Format

T- number of test cases. T

Output Format

For each test case output one number saying the number of distinct substrings.

Explanation/Hint

Explanation for the testcase with string ABABA: len=1 : A,B len=2 : AB,BA len=3 : ABA,BAB len=4 : ABAB,BABA len=5 : ABABA Thus, total number of distinct substrings is 9.