Chewbacca and Number

https://ide.codingblocks.com/s/293258 PLEASE CHECK THIS CODE, SOME OF THE TEST CASES ARE NOT PASSING

hello @CODER_JATIN
for input
999
correct output is 900
but urs is giving 0 .

handle left most digit separately ,also use using strinng in place of int for easy manipulation.

approach is simple
read a number as string (say s) .
if left most character is ‘9’

  • then leave the leftmost character as it is and for other characters simpl replace s[i] with min(s[i],‘9’-s[i])

else:

  • for each i replace s[i] with min(s[i],‘9’-s[i])

print s

Thik hai bhaiya,ho gya question ,thank you so much.