<prompt> Kupendekeza algorithm ya kupata idadi ya jumla ya substrings katika kamba fulani.string hello  <response>: Here is an algorithm to find the total number of substrings in a given string:1. Initialize a variable total_substrings and set its value to zero.2. Calculate the length of the given string n lenstring3. Find the total substrings count using the formula n n 1 2, where n is the length of the given string.4. Assign the value of the total substrings to the total_substrings variable.5. Return the value of the total_substrings variable.def total_substringsstring: n lenstring total_substrings n n 1 2 Integer division return total_substrings Explanation:This algorithm uses the mathematical formula to calculate the total number of substrings in a string of length n.- The total number of substrings of length 1 is n.- The total number of substrings of length 2 is n-1.- The total number of substrings of length 3 is n-2.- ...- The total number of substrings of length n is 1.Hence, the total number of substrings for a string of length n is n n-1 n-2 ... 1, which is an arithmetic progression with n terms, first term as 1 and last term as n,we can apply the sum of AP formula nn 12 to find the total number of substrings.For the given string hello, this algorithm returns a total of 15 substrings. 