human
Given a number as a string , find the number of contiguous subsequences which recursively add up to 9 | Python 3 program to count substrings with recursive sum equal to 9.
count = 0 To store result.
Consider every character as beginning of substring.
sum of digits in current substring.
One by one choose every character as an ending character.
Add current digit to sum , if sum becomes multiple of 5 then increment count . Let us do modular arithmetic to avoid overflow for big strings.
Driver Code"
Solution in Python:

=====
Give me a code to given a number as a string , find the number of contiguous subsequences which recursively add up to 9 and the other steps required?
assistant
#Here is code to given a number as a string , find the number of contiguous subsequences which recursively add up to 9 and the other steps required.
 def count9s ( number ) :
	n = len ( number )
	for i in range ( n ) :
		sum = ord ( number [ i ] ) - ord ( '0' )
		if ( number [ i ] == '9' ) :
			count += 1
		for j in range ( i + 1 , n ) :
			sum = ( sum + ord ( number [ j ] ) - ord ( '0' ) ) % 9
			if ( sum == 0 ) :
				count += 1
	return count
if __name__ == " _ _ main _ _ " :
	print ( count9s ( "4189" ) )
	print ( count9s ( "1809" ) )