fork(1) download
  1. s = gets.strip
  2. d = s.each_char.to_a
  3. d[0..1] = ["-#{d[1]}"] if s[0] == '-'
  4. r = s.to_i + s.size + d.map(&:to_i).inject(&:+)
  5. puts "#{s}+#{s.size}+(#{d.join '+'})=#{r}"
Success #stdin #stdout 0.05s 9664KB
stdin
-123
stdout
-123+4+(-1+2+3)=-115