human
Efficiently find first repeated character in a string without using any additional data structure in one traversal | Returns - 1 if all characters of str are unique . Assumptions : ( 1 ) str contains only characters from ' a ' to ' z ' ( 2 ) integers are stored using 32 bits.
An integer to store presence / absence of 26 characters using its 32 bits ..
If bit corresponding to current character is already set.
set bit in checker.
Driver code"
How can the above be solved in Python?

=====
Can you provide a code to efficiently find first repeated character in a string without using any additional data structure in one traversal and the other steps required?
assistant
#Here is code to efficiently find first repeated character in a string without using any additional data structure in one traversal and the other steps required.
 def FirstRepeated ( string ) :
	checker = 0
	pos = 0
	for i in string :
		val = ord ( i ) - ord ( ' a ' ) ;
		if ( ( checker & ( 1 << val ) ) > 0 ) :
			return pos
		checker |= ( 1 << val )
		pos += 1
	return - 1
string = " abcfdeacf "
i = FirstRepeated ( string )
if i != - 1 :
	print " Char ▁ = ▁ " , string [ i ] , " ▁ and ▁ Index ▁ = ▁ " , i ;
else :
	print " No ▁ repeated ▁ Char "