-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ1343.java
More file actions
33 lines (29 loc) · 1.04 KB
/
BOJ1343.java
File metadata and controls
33 lines (29 loc) · 1.04 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class BOJ1343 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
String str = br.readLine();
String[] arr = str.split("\\.");
for(int i = 0; i < arr.length; i++){
String a = arr[i];
if(a.length() % 2 != 0){
System.out.print("-1");
return;
}else if(a.length() % 4 == 0){
sb.append("AAAA".repeat(a.length() / 4));
}else{
sb.append("AAAA".repeat(a.length() / 4));
sb.append("BB");
}
if(i != arr.length - 1){
sb.append(".");
}
}
String result = sb.toString();
sb.append(".".repeat(str.length() - sb.toString().length()));
System.out.print(sb);
}
}