Skip to main content
added 88 characters in body
Source Link
Noodle9
  • 20.3k
  • 3
  • 21
  • 46

Python 3, 98 74 bytes

Saved a whopping 24 bytes thanks to ovs!!!

import re
f=lambda p:p[1:]and f(re.sub('\(((.)<.|.>(.))\)',r'\2\3',p))or p

Try it online!

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

Python 3, 98 74 bytes

Saved a whopping 24 bytes thanks to ovs!!!

import re
f=lambda p:p[1:]and f(re.sub('\(((.)<.|.>(.))\)',r'\2\3',p))or p

Try it online!

Python 3, 98 74 bytes

Saved a whopping 24 bytes thanks to ovs!!!

import re
f=lambda p:p[1:]and f(re.sub('\(((.)<.|.>(.))\)',r'\2\3',p))or p

Try it online!

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

added 88 characters in body
Source Link
Noodle9
  • 20.3k
  • 3
  • 21
  • 46

Python 3, 9898 74 bytes

Saved a whopping 24 bytes thanks to ovs!!!

import re
f=lambda p:p*(len(p)<2)orp[1:]and f(re.sub(r'\'\((.)<(.)\)',r'\1',re<.sub(r'\((|.)>(.))\)',r'\2'r'\2\3',p)))or p

Try it online!Try it online!

Python 3, 98 bytes

import re
f=lambda p:p*(len(p)<2)or f(re.sub(r'\((.)<(.)\)',r'\1',re.sub(r'\((.)>(.)\)',r'\2',p)))

Try it online!

Python 3, 98 74 bytes

Saved a whopping 24 bytes thanks to ovs!!!

import re
f=lambda p:p[1:]and f(re.sub('\(((.)<.|.>(.))\)',r'\2\3',p))or p

Try it online!

Source Link
Noodle9
  • 20.3k
  • 3
  • 21
  • 46

Python 3, 98 bytes

import re
f=lambda p:p*(len(p)<2)or f(re.sub(r'\((.)<(.)\)',r'\1',re.sub(r'\((.)>(.)\)',r'\2',p)))

Try it online!