question print and count all the substrings of a given string sample input hello sample output h he hel hell hello e el ell ello l ll llo l lo o 15 source hackerrank def findingsubstringsstring get all substrings of string and store them in an empty list list count0 for i in rangelenstring for j in rangei1 lenstring1 list appendstringi j countcount1 printing result printlist printcount driver code string inputenter string findingsubstringsstring get all substrings of string and store them in an empty list printing result driver code
def finding_substrings(string):
  
    
    list =[]
    count=0
    for i in range(len(string)):
        for j in range(i+1,(len(string)+1)):
            list.append(string[i:j])

            count=count+1
        
    
    print(list)
    print(count)


string = input("enter string: ")
finding_substrings(string)