aboutsummaryrefslogtreecommitdiff
path: root/day1.c
blob: 365e5254eef765801fc70213acd076ea85c35453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>

int main() {
  int ch, floor = 0;
  while ((ch = getchar()) != EOF) {
    switch(ch) {
      case '(':
        floor += 1;
        break;
      case ')':
        floor -= 1;
    }
  }
  printf("%d\n", floor);
  return 0;
}