human
Minimize length of prefix of string S containing all characters of another string T | Python3 program for the above approach.
Base Case - if T is empty , it matches 0 length prefix.
Convert strings to lower case for uniformity.
Update dictCount to the letter count of T.
If new character is found , initialize its entry , and increase nUnique.
Increase count of ch.
Iterate from 0 to N.
i - th character.
Skip if ch not in targetStr.
Decrease Count.
If the count of ch reaches 0 , we do not need more ch , and can decrease nUnique.
If nUnique reaches 0 , we have found required prefix.
Otherwise.
Driver Code"
How can the above be solved in Python?

Write me a code to minimize length of prefix of string S containing all characters of another string T and the other steps required?
assistant
#Here is code to minimize length of prefix of string S containing all characters of another string T and the other steps required.
 def getPrefixLength ( srcStr , targetStr ) :
	if ( len ( targetStr ) == 0 ) :
		return 0
	srcStr = srcStr . lower ( )
	targetStr = targetStr . lower ( )
	dictCount = dict ( [ ] )
	nUnique = 0
	for ch in targetStr :
		if ( ch not in dictCount ) :
			nUnique += 1
			dictCount [ ch ] = 0
		dictCount [ ch ] += 1
	for i in range ( len ( srcStr ) ) :
		ch = srcStr [ i ]
		if ( ch not in dictCount ) :
			continue
		dictCount [ ch ] -= 1
		if ( dictCount [ ch ] == 0 ) :
			nUnique -= 1
		if ( nUnique == 0 ) :
			return ( i + 1 )
	return - 1
if __name__ == " _ _ main _ _ " :
	S = " MarvoloGaunt "
	T = " Tom "
	print ( getPrefixLength ( S , T ) )