 REMMAX - EDITORIAL

https://www.codechef.com/viewsolution/24476112
I have checked for all the above testcases given in editorial.
All test cases show green, except second one.
Can anyone tell me which testcases break my code? https://www.codechef.com/viewsolution/24476112
I have checked for all the above testcases given in editorial.
All test cases show green, except second one.
Can anyone tell me which testcases break my code? There are few test cases which I found for which your program is giving wrong output and these include 148(output should be 139 but your program is giving 148),118,128,138,198,1708,1808,1908

Thanks, got AC My code gives right output for mention test cast in editorial but when. But my submission gives WA. Please, anyone, help me where my mistake.

t=int(input())

def reverse1(n):
n=list(str(n))
n=reversed(n)
return int("".join(n))

for _ in range(t):
n=int(input())
n1=str(n)
str1=’’
index=0
maxx=reverse1(n)
arr=[]
for i in n1:
arr.append(int(i))
if sum(arr)==1:
print((len(arr)-1)‘9’)
else:
for i in range(len(n1)):
if i==0 and int(n1[i])==1:
str1+=n1[i]
else:
if int(n1[i])>0:
str1+=str(int(n1[i])-1)
str1+=(len(n1)-(i+1))
‘9’
index=i
break
else:
str1+=n1[i]
s=list(str1)
s.reverse()
s=int("".join(s))
print(max(maxx,s))

my code is correct but the submission is WA why.
input:
3
10009999000
1000999000
100099000
output
10008999999
1000899999
100089999