human
Number of substrings that start with " geeks " and end with " for " | Function to return the count of required substrings.
For every index of the string.
If the substring starting at the current index is " geeks ".
If the substring is " for ".
Driver code"
Solution in Python:
 ... Write me a code to number of substrings that start with " geeks " and end with " for " and the other steps required?
assistant
#Here is code to number of substrings that start with " geeks " and end with " for " and the other steps required.
 def countSubStr ( s , n ) :
	c1 = 0 ; c2 = 0 ;
	for i in range ( n ) :
		if ( s [ i : i + 5 ] == " geeks " ) :
			c1 += 1 ;
		if ( s [ i : i + 3 ] == " for " ) :
			c2 = c2 + c1 ;
	return c2 ;
if __name__ == " _ _ main _ _ " :
	s = " geeksforgeeksisforgeeks " ;
	n = len ( s ) ;
	print ( countSubStr ( s , n ) ) ;