aboutsummaryrefslogtreecommitdiff
path: root/day1.c
diff options
context:
space:
mode:
Diffstat (limited to 'day1.c')
-rw-r--r--day1.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/day1.c b/day1.c
new file mode 100644
index 0000000..365e525
--- /dev/null
+++ b/day1.c
@@ -0,0 +1,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;
+}