Skip to content

Commit 95f0a5c

Browse files
committed
🎉 feat: initial commit for 1016 using java
1 parent fbef5ca commit 95f0a5c

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.io.BufferedReader;
2+
import java.io.IOException;
3+
import java.io.InputStreamReader;
4+
5+
public class Main {
6+
public static void main(String[] args) throws IOException {
7+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8+
String str = br.readLine();
9+
String[] strs = str.split(" ");
10+
char[] a1 = strs[0].toCharArray();
11+
int d1 = Integer.parseInt(strs[1]);
12+
char[] a2 = strs[2].toCharArray();
13+
int d2 = Integer.parseInt(strs[3]);
14+
int i, sum1 = 0, sum2 = 0;
15+
for (i = 0; i < a1.length; i++) {
16+
if ((a1[i] - '0') == d1) {
17+
sum1 = sum1 * 10 + d1;
18+
}
19+
}
20+
for (i = 0; i < a2.length; i++) {
21+
if ((a2[i] - '0') == d2) {
22+
sum2 = sum2 * 10 + d2;
23+
}
24+
}
25+
System.out.println(sum1 + sum2);
26+
}
27+
}

0 commit comments

Comments
 (0)