DISUBSTR - Distinct Substrings
题意翻译
给定一个字符串,求该字符串含有的本质不同的子串数量。
题目描述
Given a string, we need to find the total number of its distinct substrings.
输入输出格式
输入格式
T- number of test cases. T<=20;
Each test case consists of one string, whose length is <= 1000
输出格式
For each test case output one number saying the number of distinct substrings.
输入输出样例
输入样例 #1
2
CCCCC
ABABA
输出样例 #1
5
9
说明
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.