-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBAEKJOON_1541
More file actions
39 lines (26 loc) · 911 Bytes
/
BAEKJOON_1541
File metadata and controls
39 lines (26 loc) · 911 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
35
36
37
38
39
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static int ans = Integer.MAX_VALUE;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st = new StringTokenizer(br.readLine(),"-");
while(st.hasMoreTokens()){
int temp=0;
StringTokenizer st2 = new StringTokenizer(st.nextToken(),"+");
while(st2.hasMoreTokens()){
temp +=Integer.parseInt(st2.nextToken());
}
if(ans ==Integer.MAX_VALUE){
ans = temp;
}else{
ans -=temp;
}
}
bw.write(ans+"\n");
bw.flush();
bw.close();
}
}