#include #include #include using namespace std; #define MAXN 100 int n, mat[MAXN][MAXN]; void solve(int irow, int jrow, int icol, int jcol){ for (int i = 0; i < n; i++){ vector ans; int cnt = 0; for (int j = 0; j < n; j++){ if (mat[i*irow+j*jrow][i*icol+j*jcol]){cnt++; continue;} if (cnt == 0) continue; ans.push_back(cnt); cnt = 0; } if (ans.size() == 0 || cnt) ans.push_back(cnt); for (int j = 0; j < ans.size(); j++){ cout << ans[j] << (j + 1 < ans.size() ? " " : "\n"); } } } int main(){ while (1){ cin >> n; if (n == 0) break; for (int i = 0; i < n; i++){ string line; cin >> line; for (int j = 0; j < n; j++){ mat[i][j] = line[j] == 'X' ? 1 : 0; } } solve(1, 0, 0, 1); solve(0, 1, 1, 0); } return 0; }