Language: C++

/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-08 17:42:58
**/
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char>> board(H, vector<char>(W, ' '));
    rep(i, H){
        rep(j, W){
            cin >> board[i][j];
            cout << board[i][j];
        }
        cout << endl;
    }
    rep(i, H){
        bool flag = true;
        rep(j, W){
            if(board[i][j] == '#'){
                flag = false;
                continue;
            }
        }
        if(flag == true){
            rep(j, W){
                board.erase(i)(j);
            }
        }
    }
    rep(j, W){
        bool flag = true;
        rep(i, H){
            if(board[i][j] == '#'){
                flag = false;
                continue;
            }
        }
        if(flag == true){
            rep(i, H){
                board.erase(i)(j);
            }
        }
    }
    rep(i, H){
        rep(j, W){
            //if(board[i][j] != 'x'){
                cout << board[i][j];
            //}else{

            //}
        }
        cout << endl;
    }
return 0;}

/**
 * compile: g++ code.cpp
 * run: ./a.out
 * insert date string: ctrl + shift + i
**/ 

Compiler output:
a.cc: In function 'int main()':
a.cc:32:28: error: no matching function for call to 'std::vector<std::vector<char> >::erase(int&)'
   32 |                 board.erase(i)(j);
      |                 ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; iterator = std::vector<std::vector<char> >::iterator; const_iterator = std::vector<std::vector<char> >::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<char> >::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; iterator = std::vector<std::vector<char> >::iterator; const_iterator = std::vector<std::vector<char> >::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:46:28: error: no matching function for call to 'std::vector<std::vector<char> >::erase(int&)'
   46 |                 board.erase(i)(j);
      |                 ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; iterator = std::vector<std::vector<char> >::iterator; const_iterator = std::vector<std::vector<char> >::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<char> >::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; iterator = std::vector<std::vector<char> >::iterator; const_iterator = std::vector<std::vector<char> >::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided