Two testcases are showing TLE for my code can u please help me

import java.util.;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner s=new Scanner(System.in);
long digit=s.nextInt();
long inverted=0;
long sum=0;
long count=1;
while(digit!=0){
long t=digit%10;
if(digit/10==0){
if(t==9){
sum+=9
count;
break;
}
}
inverted=9-t;
if(inverted<t){
t=inverted;

		}
		sum=sum+(t*count);
		count*=10;
		digit/=10;
	}
		
	System.out.println(sum);
}

}

Hey @prateekmalhotra051199 You have not given consideration to the constraint that The decimal representation of the final number shouldn’t start with a zero take this in consideration and you are good to go.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.