#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct st {
  long int x, y, s;
};
long int n, m, ans;
st res[1000000];
bool a[1007][1007], r[1007][1007];
char c;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (long int i = 0; i < n; i++) {
    for (long int j = 0; j < m; j++) {
      cin >> c;
      if (c == '*')
        a[i][j] = true;
      else
        a[i][j] = false;
    }
  }
  for (long int i = 0; i < n; i++) {
    for (long int j = 0; j < m; j++) {
      if (a[i][j]) {
        long int x = j, y = i;
        while (a[--y][x] && y > -1)
          ;
        res[ans].s = abs(i - y) - 1;
        x = j, y = i;
        while (a[y][++x] && x < m)
          ;
        res[ans].s = min(res[ans].s, abs(j - x) - 1);
        x = j, y = i;
        while (a[++y][x] && y < n)
          ;
        res[ans].s = min(res[ans].s, abs(i - y) - 1);
        x = j, y = i;
        while (a[y][--x] && x > -1)
          ;
        res[ans].s = min(res[ans].s, abs(j - x) - 1);
        if (res[ans].s > 0) {
          res[ans].x = i;
          res[ans].y = j;
          for (long int h = i - res[ans].s; h <= i + res[ans].s; h++)
            r[h][j] = true;
          for (long int h = j - res[ans].s; h <= j + res[ans].s; h++)
            r[i][h] = true;
          ans++;
        }
      }
    }
  }
  bool ok = true;
  for (long int i = 0; i < n; i++) {
    for (long int j = 0; j < m; j++) {
      if (a[i][j] ^ r[i][j]) ok = false;
    }
  }
  if (ok) {
    cout << ans << "\n";
    for (long int i = 0; i < ans; i++) {
      cout << res[i].x + 1 << " " << res[i].y + 1 << " " << res[i].s << "\n";
    }
  } else
    cout << -1;
}
