human
Count occurrences of a substring recursively | Recursive function to count the number of occurrences of " hi " in str ..
Base Case.
Recursive Case Checking if the first substring matches.
Otherwise , return the count from the remaining index.
Driver Code"
Solution in Python:

=====
Give me a code to count occurrences of a substring recursively and the other steps required?
assistant
#Here is code to count occurrences of a substring recursively and the other steps required.
 def countSubstrig ( str1 , str2 ) :
	n1 = len ( str1 ) ;
	n2 = len ( str2 ) ;
	if ( n1 == 0 or n1 < n2 ) :
		return 0 ;
	if ( str1 [ 0 : n2 ] == str2 ) :
		return countSubstrig ( str1 [ n2 - 1 : ] , str2 ) + 1 ;
	return countSubstrig ( str1 [ n2 - 1 : ] , str2 ) ;
if __name__ == ' _ _ main _ _ ' :
	str1 = " geeksforgeeks " ;
	str2 = " geeks " ;
	print ( countSubstrig ( str1 , str2 ) ) ;
	str1 = " hikakashi " ;
	str2 = " hi " ;
	print ( countSubstrig ( str1 , str2 ) ) ;