human
Find uncommon characters of the two strings | Set 2 | Function to print the uncommon characters in the given string in sorted order.
Converting character to ASCII code.
Bit operation.
Converting character to ASCII code.
Bit operation.
XOR operation leaves only uncommon characters in the ans variable.
Driver code"
Solution in Python:
 ... Write me a code to find uncommon characters of the two strings and the other steps required?
assistant
#Here is code to find uncommon characters of the two strings and the other steps required.
 def printUncommon ( str1 , str2 ) :
	a1 = 0 ; a2 = 0 ;
	for i in range ( len ( str1 ) ) :
		ch = ord ( str1 [ i ] ) - ord ( ' a ' ) ;
		a1 = a1 | ( 1 << ch ) ;
	for i in range ( len ( str2 ) ) :
		ch = ord ( str2 [ i ] ) - ord ( ' a ' ) ;
		a2 = a2 | ( 1 << ch ) ;
	ans = a1 ^ a2 ;
	i = 0 ;
	while ( i < 26 ) :
		if ( ans % 2 == 1 ) :
			print ( chr ( ord ( ' a ' ) + i ) , end = " " ) ;
		ans = ans // 2 ;
		i += 1 ;
if __name__ == " _ _ main _ _ " :
	str1 = " geeksforgeeks " ;
	str2 = " geeksquiz " ;
	printUncommon ( str1 , str2 ) ;