
def solve(field, h, w)
  res = Array.new(h).map {Array.new(w, -1)}
  field.each.with_index do |row, i|
    row.each.with_index do |c, j|
      res[i][j] = res[i][j-1] + 1 if res[i][j-1] >= 0 and c == "."
      res[i][j] = 0 if c == "c"
    end
  end
  res.map {|row| row.join(" ")  }.join("\n")
end

h, w = gets.split(" ").map(&:to_i)
field = []
h.times { field << gets.strip.chars }
puts solve(field, h, w)