a little parsing challenge ☺

Robert Klemme shortcutter at googlemail.com
Sun Jul 17 12:54:59 EDT 2011


On 07/17/2011 06:01 PM, Robert Klemme wrote:
> On 07/17/2011 03:55 PM, mhenn wrote:
>> Am 17.07.2011 15:20, schrieb Robert Klemme:
>>> On 07/17/2011 11:48 AM, Raymond Hettinger wrote:
>>>> On Jul 17, 12:47 am, Xah Lee<xah... at gmail.com> wrote:
>>>>> i hope you'll participate. Just post solution here. Thanks.
>>>>
>>>> http://pastebin.com/7hU20NNL
>>>
>>> Ruby solution: https://gist.github.com/1087583
>>
>> I acutally don't know Ruby that well, but it looks like your program
>> recognizes "[(])" as correct although it is not, because you translate
>> "[(])" to "(())" (which is indeed correct, but does not resemble the
>> input correctly anymore).
>
> Right you are. The optimization breaks the logic. Good catch!

Turns out with a little possessiveness I can fix my original approach 
which has the added benefit of not needing three passes through the file 
(the two #tr's are obsolete now).

https://gist.github.com/1087583

Cheers

	robert



More information about the Python-list mailing list