human
Count of ordered triplets ( R , G , B ) in a given original string | function to count the ordered triplets ( R , G , B ).
count the B ( blue ) colour.
Driver Code"
Solution in Python:
 Give me a code to count of ordered triplets ( R , G , B ) in a given original string and the other steps required?
assistant
#Here is code to count of ordered triplets ( R , G , B ) in a given original string and the other steps required.
 def countTriplets ( color ) :
	result = 0 ; Blue_Count = 0 ;
	Red_Count = 0 ;
	for c in color :
		if ( c == ' B ' ) :
			Blue_Count += 1 ;
	for c in color :
		if ( c == ' B ' ) :
			Blue_Count -= 1 ;
		if ( c == ' R ' ) :
			Red_Count += 1 ;
		if ( c == ' G ' ) :
			result += Red_Count * Blue_Count ;
	return result ;
if __name__ == " _ _ main _ _ " :
	color = " RRGGBBRGGBB " ;
	print ( countTriplets ( color ) ) ;