-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathANARC09A.cpp
More file actions
45 lines (38 loc) · 811 Bytes
/
ANARC09A.cpp
File metadata and controls
45 lines (38 loc) · 811 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
40
41
42
43
44
45
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <limits.h>
#include <cstring>
#define ll int
#define get(a) scanf("%d", &a)
#define rep(n) for( ll i = 0; i < n; i++ )
#define repVector(v) for(vector<ll>::iterator it = v.begin(); it != v.end(); it++ )
#define all(c) c.begin(), c.end()
#define repu(a,n) for( ll i = a; i < n; i++ )
#define pb push_back
using namespace std;
int main() {
long t = 0;
while(1) {
t++;
char str[3000];
scanf("%s", &str);
if( str[0] == '-' )
break;
long count = 0;
long check = 0;
repu( 0, strlen(str) ) {
if( str[i] == '}' ) {
check--;
if( check < 0 )
{ check = 1; count++; }
}
else
check++;
}
cout << t << ". " << count + check/2 << endl;
}
}