human
Find the number of occurrences of a character upto preceding position | Function to find the number of occurrences of a character at position P upto p - 1.
Iterate over the string.
Store the Occurrence of same character.
Increase its frequency.
Return the required count.
Driver code.
Function call"
Solution in Python:

=====
Write me a code to find the number of occurrences of a character upto preceding position and the other steps required?
assistant
#Here is code to find the number of occurrences of a character upto preceding position and the other steps required.
 def countOccurrence ( s , position ) :
	alpha = [ 0 ] * 26
	b = [ 0 ] * len ( s )
	for i in range ( 0 , len ( s ) ) :
		b [ i ] = alpha [ ord ( s [ i ] ) - 97 ]
		alpha [ ord ( s [ i ] ) - 97 ] = alpha [ ord ( s [ i ] ) - 97 ] + 1
	return b [ position - 1 ]
s = " ababababab "
p = 9
print ( countOccurrence ( s , p ) )