InfyTQ_questions

On 26th July I give infyTQ exam there they ask this question please help me for solving this question
Input: an alphanumeric string
Output: largest even number
1.
If input number have no any even number then print -1 else print largest even number
2.
Duplicate number is not allowed means if any number come multiple times then you have to consider that number only one time
3.
Consider 0 as even number

Example:
1.
Input:shu@124s1
Output:412
2.
Input:sdg#$&1937&+
Output:-1

why this is in DP??.,.,.,.

S=input()
E=[]
A=[int(x) for x in S if x.isdigit()]
x=set(A)
A=list(x)
for i in range(len(A)):
if(A[i]%2 == 0):
E.append(A[i])
if(len(E)>0):
A.sort()
A.reverse()
A.remove(min(E))
A.append(min(E))
for i in A:
print(i,end=’’)
else:
print(-1)

checkout this code .