-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patherase.java
34 lines (30 loc) · 948 Bytes
/
erase.java
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
import java.io.*;
import java.util.*;
public class erase {
public static void main(String args[]) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int switches = Integer.parseInt(in.readLine());
String a = in.readLine();
String b = in.readLine();
String check;
if(switches % 2 == 1) {
check = a.replace("0", "2");
check = check.replace("1", "0");
check = check.replace("2", "1");
}
else {
check = a;
}
if(check.equals(b)) {
out.println("Deletion succeeded");
}
else {
out.println("Deletion failed");
}
//out.println(check);
//out.println(a);
//out.println(b);
out.close();
}
}