#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
char G[N][N];
char F[N][N];
vector<pair<pair<int, int>, int> > ANS;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> G[i][j];
      F[i][j] = '.';
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (G[i][j] == '.') continue;
      int sz = 1;
      while (1) {
        if (i - sz == 0 or i + sz == n + 1 or j - sz == 0 or j + sz == m + 1)
          break;
        if (G[i - sz][j] == '.' or G[i + sz][j] == '.' or G[i][j - sz] == '.' or
            G[i][j + sz] == '.')
          break;
        sz++;
      }
      if (sz == 1) continue;
      F[i][j] = '*';
      for (int k = 1; k < sz; k++) {
        F[i - k][j] = F[i + k][j] = F[i][j - k] = F[i][j + k] = '*';
      }
      ANS.push_back(make_pair(make_pair(i, j), sz - 1));
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (F[i][j] != G[i][j]) {
        cout << "-1\n";
        exit(0);
      }
    }
  }
  cout << ANS.size() << "\n";
  for (auto it : ANS) {
    cout << it.first.first << " " << it.first.second << " " << it.second
         << "\n";
  }
  return 0;
}
