Count number of non-empty substrings of string.

In this program, we will take a string as input and count a number of non-empty substrings of a given string.

Steps to remove the program
  1. Take a string as input.
  2. Count the number of non-empty substrings using the following formula- n*n+1/2  where n is the length of the string.
  3. Print the output.
				
					#Input string
str1 = "sqatools12"

result = int(len(str1) * (len(str1) + 1) / 2)

#Printing output
print(result)
				
			

Output :

				
					55
				
			

count all the Uppercase, Lowercase, special character and numeric values in a given string

remove unwanted characters from a given string

Leave a Comment