All submissions for this problem are available.
Sheh ! You are bored again. :P
You guys decide to play a game, this time based on your names. All of you write your name on a sheet of paper and the one whose name has the maximum number of distinct substrings of his name wins the game.
But counting this is a tiresome task, isn't it ?
So, you think about writing a clever piece of code for doing this and finding out the winner amongst you.
The winner takes it all.
You are given a string and you have to find the number of distinct substrings of that string.
The first line of input contains a single integer T denoting the number of test cases.
Then T lines follow.
Each line is a string of length <=100
For each test case, output the number of distinct substrings on a single line.
Length of strings<=100
Input: 2 CCCCC ABABA Output: 5 9
Example case 2. 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.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions