SUBST1 - New Distinct Substrings

题意翻译

给定一个**仅包含英文字母的**字符串,求该字符串含有的本质不同的子串数量。 注:这道题是 SPOJ-694 的加强版。

题目描述

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 <= 50000

输出格式


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

输入输出样例

输入样例 #1

2
CCCCC
ABABA

输出样例 #1

5
9