h, w = gets.split.map(&:to_i)
a = (1..h).map{ gets.chomp.split("").map{|c| c == 'c' ? 0 : -1} }
(0..h-1).each{|i|
    (1..w-1).each{|j|
        a[i][j] = a[i][j-1] + 1 if a[i][j] < 0 && a[i][j-1] >= 0
    }
}
a.each{|row| puts row.join(" ")}