I am getting wrong answer in problem http://www.spoj.com/problems/MINSEQ/
please help me with my this solution https://ideone.com/ZlcC3u
Your solution will give wrong answer for most of the cases like (987,9876) and (8769,9876).
1 Like
What should be correct answer for these cases? they are giving 9879876 and 87699876… They must be correct answers aren’t they?? @abhishek1995
can anybody tell me where is this going wrong ?`
__author__ = 'Achut'
try :
while True:
a = str(input())
if a == "":
break;
b = str(input())
t = 0 ;
flag = 0;
for i in range(a.__len__()):
if a[i] > b[0]:
t = i
flag = 1
break;
if flag is 0 :
t = a.__len__()
ans = a[:t]
ans = ans + b
ans = ans + a[t:]
print(ans)
except:
pass
`