Given a string of length N of lowercase alphabet characters. The task is to complete the function countDistinctSubstring(), which returns the count of total number of distinct substrings of this string.
The first line of input contains an integer T, denoting the number of test cases. Then T test cases follow. Each test case contains a string str.
For each test case in a new line, output will be an integer denoting count of total number of distinct substrings of this string.
Since this is a functional problem you don't have to worry about input, you just have to complete the function countDistinctSubstring().
1 <= T <= 50
1 <= N <= 1000
Example(To be used only for expected output):
Testcase 1: For the given string "ab" the total distinct substrings are: "", "a", "b", "ab".
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.