fun main(args:Array<String>):Unit {
    val (h, w) = readLine()!!.trim().split(' ').map(String::toInt)
    val state = Array(h){readLine()!!.trim()}
    val forecast = Array(h){Array(w){-1}}
    for (y in 0 until h){
        for (x in 0 until w){
            if (state[y][x] == 'c'){
                forecast[y][x] = 0
            }else{
                if (x > 0 && forecast[y][x - 1] >= 0) forecast[y][x] = forecast[y][x - 1] + 1
            }
        }
    }
    forecast.forEach {
        println(it.joinToString(" "))
    }
}
