Your solution will give wrong answer for most of the cases like (987,9876) and (8769,9876).
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: 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 `
What should be correct answer for these cases? they are giving 9879876 and 87699876… They must be correct answers aren’t they?? @abhishek1995
@vinayawsm: Correct answers would be 9876987 and 87698769.