1 #include <iostream> 2 #include <sstream> 3 #include <string> 4 #include <algorithm> 5 #include <vector> 6 using namespace std; 7 8 #define GI ({int _t; scanf("%d", &_t); _t;}) 9 #define FOR(i, a, b) for (int i=a; i<b; i++) 10 #define REP(i, a) FOR(i, 0, a) 11 template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();} 12 int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;} 13 #define DBG(x) cout << #x << "::" << x << endl; 14 #define DBGV(_v) { REP(_i, _v.size()) { cout << _v[_i] << "\t";} cout << endl;} 15 #define OK(x, y) (x>=0 && y>=0 && x<a && y<b) 16 17 int main() { 18 int a, b; 19 while (scanf("%d%d", &a, &b) != -1 && a != 0) { 20 vector <string> grid; 21 string t; 22 REP(i, a) { 23 cin >> t; 24 grid.push_back(t); 25 } 26 int res = 0; 27 REP(i, a) { 28 REP(j, b) { 29 if (grid[i][j] == '*') { 30 bool star = true; 31 FOR(dx, -1, 2) { 32 FOR(dy, -1, 2) { 33 if (dx == 0 && dy == 0) continue; 34 if (OK(i+dx, j+dy) && grid[i+dx][j+dy]=='*') { 35 star = false; 36 } 37 } 38 } 39 if (star == true) res++; 40 } 41 } 42 } 43 printf("%d\n", res); 44 } 45 return 0; 46 }