T = gets.to_i T.times do s = gets.chomp puts s.gsub(/\d+/) { |v| v.to_i + 1 } end