human
Partition string into two substrings having maximum number of common non | Function to count maximum common non - repeating characters that can be obtained by partitioning the string into two non - empty substrings.
Stores count of non - repeating characters present in both the substrings.
Stores distinct characters in left substring.
Stores distinct characters in right substring.
Traverse left substring.
Insert S [ i ] into ls.
Traverse right substring.
Insert S [ i ] into rs.
Traverse distinct characters of left substring.
If current character is present in right substring.
Update cnt.
Return count.
Function to partition the string into two non - empty substrings in all possible ways.
Stores maximum common distinct characters present in both the substring partitions.
Traverse the string.
Update ans.
Print count of maximum common non - repeating characters.
Driver Code"
Solution in Python:

Write me a code to partition string into two substrings having maximum number of common non and the other steps required?
assistant
#Here is code to partition string into two substrings having maximum number of common non and the other steps required.
 def countCommonChar ( ind , S ) :
	cnt = 0
	ls = set ( )
	rs = set ( )
	for i in range ( ind ) :
		ls . add ( S [ i ] )
	for i in range ( ind , len ( S ) ) :
		rs . add ( S [ i ] )
	for v in ls :
		if v in rs :
			cnt += 1
	return cnt
def partitionStringWithMaxCom ( S ) :
	ans = 0
	for i in range ( 1 , len ( S ) ) :
		ans = max ( ans , countCommonChar ( i , S ) )
	print ( ans )
if __name__ == " _ _ main _ _ " :
	string = " aabbca "
	partitionStringWithMaxCom ( string )