# [C (gcc)], <sup><s>117</s> \$\cdots\$ <s>101</s></sup> 98 bytes Saved 10 bytes thanks to an idea from [Davide](https://codegolf.stackexchange.com/users/100356/davide)!!! Saved 3 bytes (and got below 100!) thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!! <!-- language-all: lang-c --> i;f(char*p){for(i=0;*p++-40||p[3]-41;++i);p[-1]=p[p[1]-62?0:2];bcopy(p+4,p,strlen(p));i&&f(p+~i);} [Try it online!][TIO-kktrd85a] [C (gcc)]: https://gcc.gnu.org/ [TIO-kktrd85a]: https://tio.run/##XVPBbsIwDP0VVAmUtKlEWbUJ4pozd26lhxG1W6UNItoDE7BfZ06cFrRLFNnP7z07jkk/jLnfW90I8/l@iq28NMeTaIu5jm2SpPn8erXlS5XmmU6SVmpbpllV2NKWWZW@Ltbz1aLSe3O0P8ImubKq609f9UFYKXU7mzUU/aWy232jOhVvy6q4RAIRZKQiASCArv5OQZQhLigOKOmgJISYQF9HYaTcExYoA1RMWOFzdHicL@dad3UZTxFUWXLAEDtXe2FKBHAIghy5HDsfziSdjEPPCWxdDn0wmJsbJNEZAW5n1HeSD68YuLmToIveHAQEjr6RO3UNAP73imwTgzUIhnHEIDAMmQLZrAwzwkFHhNmF@fuDORkN@KwJj0EMrwlMic@cMD6Fp8FhsDgM1jt/7t@x@Br3MkNH7u28qpv7TcW9/n5vD6LmZdYbWMy1PbWHvhHRtJukOJmaye5cL3bnpZma3SFSPa1nl9brLF@usvxNyov7D5N9Gfa5L7blppIVfRSKGFr3veppx7si3qu6iACjcpMkuKz07Xb/Aw "C (gcc) – Try It Online" Takes an input string with enclosing parentheses and reduces it to either a left (`<`) or a right (`>`). ### Explanation (before some golfs) i;f(char*p){ // function taking a string parameter p for(i=0;p[i++]-40||p[i+3]-41;); // loop until we find chars '(' and ')' // separated by 3 characters. // since our input is enclosed in // parentheses we will always find one. p[i-1]= // i has gone forward one but set the // first of these characters - the '(' // to... p[i+1]-62? // ...depending on whether the middle // char is a '<' or a '>'... p[i]: // ...the one before the middle if '<' p[i+2]; // ...the one after the middle if '>' memcpy(p+i,p+i+4,strlen(p)); // move the back end of the string forward // over the other 4 chars. // now a "(A<B)" is reduced to "A" // and a "(A>B)" is reduced to "B" ~-i&& // if we didn't just reduce the start of p f(p); // then recursively call f. // otherwise p is reduced to the answer // and we're done. }