human
Given a binary string , count number of substrings that start and end with 1. | A simple Python 3 program to count number of substrings starting and ending with 1.
Initialize result.
Pick a starting point.
Search for all possible ending point.
Driver program to test above function"
Solution in Python:

Write me a code to given a binary string , count number of substrings that start and end with 1?
assistant
#Here is code to given a binary string , count number of substrings that start and end with 1.
 def countSubStr ( st , n ) :
	res = 0
	for i in range ( 0 , n ) :
		if ( st [ i ] == '1' ) :
			for j in range ( i + 1 , n ) :
				if ( st [ j ] == '1' ) :
					res = res + 1
	return res
st = "00100101" ;
list ( st )
n = len ( st )
print ( countSubStr ( st , n ) , end = " " )