def parentmatched(inputstring)
while inputstring != nil
p inputstring
break if (inputstring.gsub!(/\(\)/, '')==nil)
end
if inputstring.eql?('')
puts "matched"
else
puts "non-matched"
end
end
parentmatched("((())(())()(()))()");
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment