aoc_2015_1_1.c (267B)
1 #include <string.h> 2 3 long perform(char *data) { 4 (void) data; 5 int len = strlen(data); 6 long floor = 0; 7 for (int i = 0; i < len; i++) { 8 char c = data[i]; 9 if (c == '(') { 10 floor++; 11 } 12 if (c == ')') { 13 floor--; 14 } 15 } 16 return floor; 17 }