human
Count of distinct characters in a substring by given range for Q queries | Python3 program for Naive Approach.
Counter to count distinct char.
Initializing frequency array to count characters as the appear in substring S [ L : R ].
Iterating over S [ L ] to S [ R ].
Incrementing the count of s [ i ] character in frequency array.
If frequency of any character is > 0 then increment the counter.
Driver code"
How can the above be solved in Python?

=====
Give me a code to count of distinct characters in a substring by given range for Q queries and the other steps required?
assistant
#Here is code to count of distinct characters in a substring by given range for Q queries and the other steps required.
 def findCount ( s , L , R ) :
	distinct = 0
	frequency = [ 0 for i in range ( 26 ) ]
	for i in range ( L , R + 1 , 1 ) :
		frequency [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1
	for i in range ( 26 ) :
		if ( frequency [ i ] > 0 ) :
			distinct += 1
	print ( distinct )
if __name__ == ' _ _ main _ _ ' :
	s = " geeksforgeeksisacomputerscienceportal "
	queries = 3
	Q = [ [ 0 , 10 ] , [ 15 , 18 ] , [ 12 , 20 ] ]
	for i in range ( queries ) :
		findCount ( s , Q [ i ] [ 0 ] , Q [ i ] [ 1 ] )