#include <iostream>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int H, W;
cin >> H >> W;
for (int i = 0; i < H; ++i) {
string sky;
cin >> sky;
int time = -1;
for (int j = 0; j < W; ++j) {
if (sky[j] == 'c')
time = 0;
else if (time != -1) time++;
cout << time << " ";
}
cout << "\n";
}
return 0;
}