Substrings
시간 제한: 1000ms메모리 제한: 128MB출처: CCC 2003 SeniorBOJ 6908
문제
How many distinct substrings does a given string have?
For example, if abc, has distinct substrings: , a, b, c, ab, bc, abc. Note that the empty string and itself are considered substrings of .
On the other hand, if aaa. has only distinct substrings: , a, aa, aaa.
입력
The first line of the input file contains , the number of test cases. For each test case, a line follows giving , a string of from to alphanumeric characters.
출력
Your output consists of one line per case, giving the number of distinct substrings of .
예제
예제 1
입력
2 abc aaa
출력
7 4
코드를 제출하려면 로그인하세요.