Quiz#112

#ok, here’s my perhaps inelegant solution, and hi, I’m Kyle.

input=gets("\n")
input.downcase!
input.gsub!(/[^a-z+=]/,’’)
left=input.split("==").first.split(’+’)
right=input.split("==").last.split(’+’)
exit(1) unless right.length==(right-left).length
class String
def ==(i)
if super(self.split(’’).sort.join)
return(super(i.split(’’).sort.join))
else
return(self.split(’’).sort.join==i.split(’’).sort.join)
end
end
end
left=left.join
right=right.join
success=(left==right)
exit(1) unless success
puts success
exit(0)

Wowzers I feel dense, I should wake up more before writing/posting :wink:

On Feb 8, 2007, at 4:23 PM, Kyle S. wrote:

Wowzers I feel dense, I should wake up more before writing/posting :wink:

Well, it solved a different part of the problem, but was still neat
to see.

James Edward G. II

Heh, Thanks!