//#pragma GCC optimize("O3") //#pragma GCC target("avx2") # include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
#ifdef __APPLE__ #include "important/debug.h" #else #define dbg(...) 42 #endif #define LL long long #define LD long double //#define create(a,b,c,d) mp(a,mp(b,mp(c,d))) #define pb push_back #define mp make_pair #define ss second #define ff first #define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define _sz(x) (int)x.size() #define _all(x) x.begin(),x.end() #define ld long double #define lb(x, v) lower_bound(_all(x),v) #define el '\n' #define eb emplace_back using namespace std; const LL N = 2e5+10, INF = 1e18, mod =1000000007; LL a[110][110]; void dfs(LL x, LL y) { a[x][y] = 0; if(a[x-1][y] == 1) dfs(x-1, y); if(a[x][y-1] == 1) dfs(x, y-1); if(a[x+1][y] == 1) dfs(x+1, y); if(a[x][y+1] == 1) dfs(x, y+1); } int main() { LL n,m; cin >> n >> m; for(LL i = 1; i <= n; i++) { for(LL j = 1; j <= m; j++) { char ch; cin >> ch; if(ch == '*') a[i][j] = 1; } } LL ans = 0; for(LL i = 1; i <= n; i++) { for(LL j = 1; j <= m; j++) { if(a[i][j] == 1) { dfs(i, j); ans++; } } } cout << ans << el; }