#include <bits/stdc++.h>
using namespace std;
int row, column;
string grelha[1001];
bool verificador[1001][1001];
bool Valid(int x, int y) {
  return (x >= 0 && x < row && y >= 0 && y < column && grelha[x][y] == '*');
}
bool gridCheck() {
  for (int i = 0; i < row; i++)
    for (int j = 0; j < column; j++)
      if (grelha[i][j] == '*' && !verificador[i][j]) {
        cout << -1;
        return 0;
      }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  memset(verificador, false, sizeof verificador);
  cin >> row >> column;
  vector<pair<int, pair<int, int> > > answer;
  for (int i = 0; i < row; i++) cin >> grelha[i];
  for (int i = 1; i < row - 1; i++) {
    for (int j = 1; j < column - 1; j++) {
      int x1 = i + 1, x2 = i - 1, y1 = j + 1, y2 = j - 1;
      bool starExist = false;
      while (grelha[i][j] == '*' && Valid(x1, j) && Valid(x2, j) &&
             Valid(i, y1) && Valid(i, y2)) {
        starExist = true;
        verificador[x1++][j] = true;
        verificador[x2--][j] = true;
        verificador[i][y1++] = true;
        verificador[i][y2--] = true;
      }
      if (starExist)
        verificador[i][j] = true,
        answer.push_back({i + 1, {j + 1, x1 - i - 1}});
    }
  }
  if (gridCheck()) {
    cout << answer.size() << endl;
    for (int i = 0; i < answer.size(); i++)
      cout << answer[i].first << " " << answer[i].second.first << " "
           << answer[i].second.second << endl;
  }
}
