Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. DISUBSTR - Distinct Substrings
  2. #suffix-array-8
  3.  
  4. Given a string, we need to find the total number of its distinct substrings.
  5.  
  6. Input
  7.  
  8. T- number of test cases. T<=20;
  9. Each test case consists of one string, whose length is <= 1000
  10.  
  11. Output
  12.  
  13. For each test case output one number saying the number of distinct substrings.
  14.  
  15. Example
  16.  
  17. Sample Input:
  18. 2
  19. CCCCC
  20. ABABA
  21.  
  22. Sample Output:
  23. 5
  24. 9
  25.  
  26. Explanation for the testcase with string ABABA:
  27. len=1 : A,B
  28. len=2 : AB,BA
  29. len=3 : ABA,BAB
  30. len=4 : ABAB,BABA
  31. len=5 : ABABA
  32. Thus, total number of distinct substrings is 9.
  33.  
  34. Submit solution!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement