#include int main() { int c, total = 0, pos = 0; do { pos++; total += ((c = getchar()) == '(') - (c == ')'); } while (total != -1); printf("%d\n", pos); return 0; }