How to parse "42, 6" into Ruby variables?

Add a reply

Posted by taw 287 days ago:
So I've been wondering about the choose golf. The key is parsing something like "42, 6\n" from STDIN into a pair of variables.

I have 39 byte solution in Ruby (best is 36), and 39 byte solution in Python (best is 39), using identical algorithm.

Breakdown for Ruby:
* input - 17
* algorithm - 20
* output - 2

Breakdown for Python:
* input - 12
* algorithm - 22
* output - 5

So either it's possible to save 3 more bytes in Ruby algorithm, but not in Python (what doesn't seem very likely), or I'm parsing input inefficiently.

What's the best way to parse such input - any hints?

Add a reply