Array (  =>  => questions  => HackwithInfy-Previous-Questions  => Distinct-Substrings )
Given a string, count all substrings of the given string.
First line contains string S.
Print the count of total substrings can form.
Step-1: Find the length of string
Step-2: Calculate total substrings value is length of string * (length of string +1)/2
For every Stirng:
There will be n substring of length 1
there will be n-1 substring of length 2
there will be 1 substring of length n
Total substrings are 1+2+3+...+n = n(n+1)/2
Let us know if you can come up with a better approach, mail us at firstname.lastname@example.org Your approach will be reviewed and posted with credits to you.