#!/usr/bin/env ruby while line = STDIN.gets a = line.split label = a.shift.to_f label *= -1 a.map! { |i| k,v = i.split ":" v = v.to_f*-1 "#{k}:#{v}" } puts "#{label} #{a.join ' '}" end