All TestCase pass, but not sure my approach is correct or not. So kindly review my code

Scanner scn = new Scanner(System.in);
String in = scn.next();

	difference(in);
	
}

static void  difference(String in) {
	
	
	int len = in.length();
	int i =1;
	while(i<=len-1) {
	
	

		int b = (int)in.charAt(i-1);
		int c = (int)in.charAt(i);
		int a = c-b;
		
		
		
		char ch = in.charAt(i-1);
		
		String sdas = Character.toString(ch);
		
		
		
		
		
		System.out.print(sdas+a);
		
		
		
		i++;
	}
	char last = in.charAt(len-1);
	String sdass =  Character.toString(last);
	
	System.out.print(sdass);
}

}

Yes, @k.bhupenderagile your approach is correct.

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.