You are viewing a single comment's thread. Return to all comments →
it doesn't work so here is my solution and it work
Scanner scan = new Scanner(System.in); String s = scan.nextLine(); String t = scan.nextLine(); String [] split = s.split(""); String [] split2 = t.split(""); ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < split.length; i++) { int first = Integer.parseInt(split[i]); int second = Integer.parseInt(split2[i]); if (first == 1 && second == 1) { list.add(0); } if (first == 1 && second == 0) { list.add(1); } if (first == 0 && second == 1) { list.add(1); } if (first == 0 && second == 0) { list.add(0); } } ArrayList<String> finalL = new ArrayList<String>(); for (int i = 0; i < list.size(); i++) { finalL.add(Integer.toString(list.get(i))); } String output = String.join("", finalL); System.out.println(output);
Seems like cookies are disabled on this browser, please enable them to open this website
XOR Strings 2
You are viewing a single comment's thread. Return to all comments →
it doesn't work so here is my solution and it work