@@ -0,0 +1,640 @@
+import java.util.*;%0A%0Apublic class Parity %7B%0A  public static void main(String%5B%5D args) %7B%0A    Scanner in = new Scanner(System.in);%0A%0A    while (true) %7B%0A      char%5B%5D input = in.nextLine().toCharArray();%0A      if (input%5B0%5D == '#') %7B%0A        break;%0A      %7D%0A%0A      // Count the number of ones%0A      int ones = 0;%0A      for (char c : input) %7B%0A        if (c == '1') %7B%0A          ones++;%0A        %7D%0A      %7D%0A%0A      if (input%5Binput.length - 1%5D == 'e') %7B%0A        input%5Binput.length - 1%5D = ones %25 2 == 0 ? '0' : '1';%0A      %7D else %7B%0A        input%5Binput.length - 1%5D = ones %25 2 == 0 ? '1': '0';%0A      %7D%0A%0A      System.out.println(new String(input));%0A    %7D%0A  %7D%0A%7D%0A

Add Java local solution