human
Count of all unique substrings with non | Function to count all unique distinct character substrings.
Hashmap to store all substrings.
Iterate over all the substrings.
Boolean array to maintain all characters encountered so far.
Variable to maintain the subtill current position.
Get the position of the character in the string.
Check if the character is encountred.
Add the current character to the substring.
Insert subin Hashmap.
Driver code"
How can the above be solved in Python?

Can you provide a code to count of all unique substrings with non and the other steps required?
assistant
#Here is code to count of all unique substrings with non and the other steps required.
 def distinctSubstring ( P , N ) :
	S = dict ( )
	for i in range ( N ) :
		freq = [ False ] * 26
		s = " "
		for j in range ( i , N ) :
			pos = ord ( P [ j ] ) - ord ( ' a ' )
			if ( freq [ pos ] == True ) :
				break
			freq [ pos ] = True
			s += P [ j ]
			S [ s ] = 1
	return len ( S )
S = " abba "
N = len ( S )
print ( distinctSubstring ( S , N ) )