// https://bbc3502.hopto.org/c2021/index.php/home-17/591-1 // This code should get 100 points but due to the shitty pintia, it gets 90. #include #include #define MAXLEN 101 int main(void) { char str[MAXLEN]; // fgets is not gets fgets(str, MAXLEN, stdin); // Process string int count = 0; int mismatch = 0; for (int i = 0, n = strlen(str); i < n && !mismatch; i++) { if (str[i] == '(') { if (count < 0) { // )( mismatch = 1; } else { count++; } } else if (str[i] == ')') { count--; } } // Validate if (count != 0) { printf("parentheses do not match!\n"); } else { printf("parentheses match!\n"); } return 0; }