Skip to main content
1 of 17
Noodle9
  • 20.3k
  • 3
  • 21
  • 46

C (gcc), 120 bytes

i;f(char*p){for(i=0;p[i]-40||p[i+4]-41;++i);p[i]=p[i+2]-62?p[i+1]:p[i+3];memcpy(p+i+1,p+i+5,strlen(p));i=*p-40?*p:f(p);}

Try it online!

Takes an input string with enclosing in parentheses and returns whether it's left (<) or right (>).

Noodle9
  • 20.3k
  • 3
  • 21
  • 46