#include using namespace std; using ll = long long; using PAIR = pair; using PAIRLL = pair; using vi = vector; using vll = vector; using vvi = vector; using vs = vector; #define rep(i,n) for(int i=0;i<(n);i++) #define INF 100000000 #define REP(i,n) for(ll i=0;i=0;i--) #define FOR(i,a,b) for(ll i=a;i<=ll(b);i++) #define FORD(i,a,b) for(ll i=a;i>=ll(b);i--) #define FORA(i,I) for(const auto& i:I) //x:コンテナ #define ALL(x) x.begin(),x.end() #define SIZE(x) ll(x.size()) //定数 #define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf #define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf #define MOD 1000000007 //問題による #define F first #define S second //出力(空白区切りで昇順に) #define coutALL(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<" ";cout<<*--x.end()< vec, int number) { auto itr = std::find(vec.begin(), vec.end(), number); size_t index = std::distance( vec.begin(), itr ); if (index != vec.size()) { // 発見できたとき return 1; } else { // 発見できなかったとき return 0; } } vector vector_find_ll(vector vec,ll num){ int N = vec.size(); vector match_num; rep(i,N){ if (vec[i] == num){ match_num.push_back(i); } } return match_num; } ll vector_max(vector vec){ ll ret = -INF64; rep(i,vec.size()){ ret = max(ret,vec[i]); } return ret; } ll vector_min(vector vec){ ll ret = INF64; rep(i,vec.size()){ ret = min(ret,vec[i]); } return ret; } bool is_ok(vector lsHW,int dx,int dy){ int H,W; vector lsHW2 = lsHW; H = lsHW2.size(); W = lsHW2[0].size(); rep(i,H-dx){ rep(j,W-dy){ if (lsHW2[i][j] == '#'){ lsHW2[i][j] = '.'; if (lsHW2[i+dx][j+dy] == '.'){ return false; } else{ lsHW2[i+dx][j+dy] = '.'; } } } } rep(i,H){ rep(j,W){ if (lsHW2[i][j] == '#'){ return false; } } } return true; } int main(){ int H,W; cin >> H >> W; vector lsHW(H); rep(i,H) cin >>lsHW[i]; vector> lsp; rep(i,H){ rep(j,W){ lsp.push_back({i,j}); } } for (const auto & p:lsp){ if (is_ok(lsHW,p.first,p.second)){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; }