-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP1032.java
More file actions
33 lines (29 loc) · 949 Bytes
/
P1032.java
File metadata and controls
33 lines (29 loc) · 949 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
package quki.algorithm.string;
import java.util.Scanner;
public class P1032 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
String ans = "";
for (int j = 0; j < n; j++) {
String line = sc.nextLine();
// String[] s = line.split("\\."); //조심!!
if (j == 0) { // 가장 초기 문자열 초기화
ans = line;
} else {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < line.length(); i++) {
char orig = ans.charAt(i);
char curr = line.charAt(i);
if (orig != curr) {
orig = '?';
}
sb.append(orig);
}
ans = sb.toString();
}
}
System.out.println(ans);
}
}