Skip to main content
1 of 3
Darren Stone
  • 5.2k
  • 1
  • 19
  • 27

Ruby, 24

 r=eval s.gsub ?/,'**-1*'

Thank you to @ybeltukov for the Mathematica technique. I "knew" there was a substitution that could be used to leverage eval and yours was much simpler than the regexes I was trying!

Darren Stone
  • 5.2k
  • 1
  • 19
  • 27