#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)