Sum of odd placed and even

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
String str=Integer.toString(N);
int even=0;
int odd=0;
for(int i=0;i<str.length();i++){
int digit=str.charAt(i)-‘0’;
if(i%2!=0){

	odd+=digit;
}

}
System.out.println(odd);
for(int i=0;i<str.length();i++){
	int digit=str.charAt(i)-'0';
	if(i%2==0){
		even+=digit;
	}
}
System.out.println(even);
}

}

what s wrong with my code and test cases are failing

@niharikareddykeesara_139be65b4266e2f2 sum of even places has to be printed first and in the second line print the sum of odd places.

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.