human
Count subsequence of length three in a given string | Function to find number of occurrences of a subsequence of length three in a string.
variable to store no of occurrences.
loop to find first character.
loop to find 2 nd character.
loop to find 3 rd character.
increment count if subsequence is found.
Driver Code"
Solution in Python:
assistant
#Here is code to count subsequence of length three in a given string and the other steps required.
 def findOccurrences ( str , substr ) :
	counter = 0
	for i in range ( 0 , len ( str ) ) :
		if ( str [ i ] == substr [ 0 ] ) :
			for j in range ( i + 1 , len ( str ) ) :
				if ( str [ j ] == substr [ 1 ] ) :
					for k in range ( j + 1 , len ( str ) ) :
						if ( str [ k ] == substr [ 2 ] ) :
							counter = counter + 1
	return counter
str = " GFGFGYSYIOIWIN "
substr = " GFG "
print ( findOccurrences ( str , substr ) )