SPOJ - SUBST1 New Distinct Substrings

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

Input

T- number of test cases. T<=20; Each test case consists of one string, whose length is <= 50000

Output

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

Example

Input:
2
CCCCC
ABABA

Output:
5
9
题意:和上一道一样,无非数据大了一些
方法:后缀数组,见上一道题
代码:见上一个道题

posted @ 2017-10-10 09:26  晓风微微  阅读(95)  评论(0编辑  收藏  举报