From: Francisco Ortiz Date: 2006-05-09T06:36:18+09:00 Subject: Re: [QUIZ] Bracket Packing (#78) ------=_Part_5752_17507965.1147124173577 Content-Type: multipart/alternative; boundary="----=_Part_5753_17561299.1147124173577" ------=_Part_5753_17561299.1147124173577 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Here's my ruby n00b solution, I intended to fix erroneous strings, but I ma= y not have the time, so i'll leave it at reporting the error. ------=_Part_5753_17561299.1147124173577 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Here's my ruby n00b solution, I intended to fix erroneous strings, but I may not have the time, so i'll leave it at reporting the error.
------=_Part_5753_17561299.1147124173577-- ------=_Part_5752_17507965.1147124173577 Content-Type: application/octet-stream; name=78.balance_strings_otro.rb Content-Transfer-Encoding: 7bit X-Attachment-Id: f_emzc3wmb Content-Disposition: attachment; filename="78.balance_strings_otro.rb" class BigCo attr_reader :text Matches={"("=>")","["=>"]","{"=>"}"} def initialize(text) @text=text.gsub("\s","") parse end def parse open_containers="" can_close=false @text.each_byte do |a| test_item=a.chr if Matches.has_key?(test_item) then open_containers<