gets arr = gets.split.map(&:to_i).sort min = 1000001 (1...arr.size - 1).each do |i| min = (arr[i-1] - arr[i]).abs if (arr[i-1] - arr[i]).abs != 0 && (arr[i-1] - arr[i]).abs < min min = (arr[i+1] - arr[i]).abs if (arr[i+1] - arr[i]).abs != 0 && (arr[i+1] - arr[i]).abs < min end puts min == 1000001 ? 0 : min