h, w = gets.split.map(&:to_i)
h.times do
  s = gets
  arr = Array.new(w, -1)
  w.times{ |i| arr[i] = 0 if s[i] == "c" }
  (1...w).each{ |i| arr[i] = arr[i-1] + 1 if arr[i-1] >= 0 && (arr[i] > arr[i-1] + 1 || arr[i] == -1) }
  puts arr.join(" ")
end