human
Smallest number possible by swapping adjacent even odd pairs | Function to return the smallest number possible.
Arrays to store odd and even digits in the order of their appearance in the given string.
Insert the odd and even digits.
pointer to odd digit.
pointer to even digit.
In case number of even and odd digits are not equal If odd digits are remaining.
If even digits are remaining.
Removal of leading 0 's .
Driver Code"
Solution in Python:
assistant
#Here is code to smallest number possible by swapping adjacent even odd pairs and the other steps required.
 def findAns ( s ) :
	odd = [ ]
	even = [ ]
	for c in s :
		digit = int ( c )
		if ( digit & 1 ) :
			odd . append ( digit )
		else :
			even . append ( digit )
	i = 0
	j = 0
	ans = " "
	while ( i < len ( odd ) and j < len ( even ) ) :
		if ( odd [ i ] < even [ j ] ) :
			ans += str ( odd [ i ] )
			i = i + 1
		else :
			ans += str ( even [ j ] )
			j = j + 1
	while ( i < len ( odd ) ) :
		ans += str ( odd [ i ] )
		i = i + 1
	while ( j < len ( even ) ) :
		ans += str ( even [ j ] )
		j = j + 1
	while ( ans [ 0 ] == '0' ) :
		ans = ans [ 1 : ]
	return ans
s = "894687536"
print ( findAns ( s ) )