Now i have taken the input from user but my code is not passing all test cases

for input
4
9 9 9 9
5
9 9 9 9 9
Your Output
10, 9, 9, 9, 8, END
Correct Output
1,0,9,9,9,8

Modified Code

now it is passing all testcases

if your doubt resolved
plz mark it as resolved from your side

or i give you the link to resolve??