import java.io.*;
/* Even and odd */
public class Solution {
public static int even;
public static int odd;
public static void main(String[] args) throws IOException {
// Write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String num = reader.readLine();
char[] c = num.toCharArray();
for (int i = 0; i < c.length; i++) {
switch (c[i] % 2) {
case 0:
even++;
break;
default:
odd++;
break;
}
}
System.out.println("Even:" + even + "Odd:"+ odd); }}Copy the code
> input123456> print even:3Odd number:3
Copy the code