human
Find the duplicate characters in a string in O ( 1 ) space | Function to find duplicate characters in str1ing without using any additional data str1ucture.
Check if ( i + ' a ' ) is present in str1 at least once or not ..
Check if ( i + ' a ' ) is present in str1 at least twice or not ..
Iterate over the characters of the str1ing str1.
If str1 [ i ] has already occurred in str1.
Set ( str1 [ i ] - ' a ' ) - th bit of second.
Set ( str1 [ i ] - ' a ' ) - th bit of second.
Iterate over the range [ 0 , 25 ].
If i - th bit of both first and second is Set.
Driver Code"
Solution in Python:

Write me a code to find the duplicate characters in a string in O ( 1 ) space and the other steps required?
assistant
#Here is code to find the duplicate characters in a string in O ( 1 ) space and the other steps required.
 def findDuplicate ( str1 , N ) :
	first = 0
	second = 0
	for i in range ( N ) :
		if ( first & ( 1 << ( ord ( str1 [ i ] ) - 97 ) ) ) :
			second = second | ( 1 << ( ord ( str1 [ i ] ) - 97 ) )
		else :
			first = first | ( 1 << ( ord ( str1 [ i ] ) - 97 ) )
	for i in range ( 26 ) :
		if ( ( first & ( 1 << i ) ) and ( second & ( 1 << i ) ) ) :
			print ( chr ( i + 97 ) , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
	str1 = " geeksforgeeks "
	N = len ( str1 )
	findDuplicate ( str1 , N )