-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXOR Strings.java
More file actions
38 lines (29 loc) · 777 Bytes
/
XOR Strings.java
File metadata and controls
38 lines (29 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
/**
* @author: syed ashraf ullah
* date: 26/04/2020
* problem: https://www.hackerrank.com/challenges/strings-xor/problem
*/
public class Solution {
public static String stringsXOR(String s, String t) {
String res = new String("");
for(int i = 0; i < s.length(); i++) {
if(s.charAt(i) != t.charAt(i))
res += "1";
else
res += "0";
}
return res;
}
public static void main(String[] args) {
String s, t;
Scanner in = new Scanner(System.in);
s = in.nextLine();
t = in.nextLine();
System.out.println(stringsXOR(s, t));
}
}