-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeParsing.java
More file actions
34 lines (29 loc) · 868 Bytes
/
CodeParsing.java
File metadata and controls
34 lines (29 loc) · 868 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
34
/**
* Created by MalhotR1 on 05/16/2018.
*/
// TLE
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CodeParsing {
public static void main(String[] args) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
char[] in = br.readLine().trim().toCharArray();
long cx = 0;
for (int i = 0; i < in.length; i++) {
if (in[i] == 'x') cx++;
else cx--;
}
if (cx > 0) {
for (int i = 0; i < cx; i++) {
System.out.print('x');
}
} else {
cx = -cx;
for (int i = 0; i < cx; i++) {
System.out.print('y');
}
}
}
}
}