-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path폴리오미노.java
More file actions
41 lines (31 loc) · 1.12 KB
/
폴리오미노.java
File metadata and controls
41 lines (31 loc) · 1.12 KB
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
36
37
38
39
40
41
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
String s = br.readLine();
String[] str = s.split("\\.");
for (int i = 0; i < str.length; i++) {
String c = str[i];
if (c.length() % 2 != 0) {
sb = new StringBuilder("-1");
break;
} else if (c.length() % 4 == 0) {
sb.append("AAAA".repeat(c.length() / 4));
} else {
sb.append("AAAA".repeat(c.length() / 4));
sb.append("BB");
}
if (i != str.length - 1)
sb.append(".");
}
String res = sb.toString();
if (!res.equals("-1")) {
sb.append(".".repeat(s.length() - sb.toString().length()));
}
System.out.println(sb);
}
}