Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int H, W;
    cin >> H >> W;
    vector<vector <char>> vec(H, vector<char>(W));
    
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            cin >> vec[h][w];
        }
    }
    
    // output
    vector<vector <char>> ans(H, vector<char>(W, '?'));
    for(int h=0; h<vec.size(); h++){
        bool do_delete = true;
        for(int w=0; w<W; w++){
            if(vec[h][w] != '.'){
                do_delete = false;
                break;
            }
        }
        
        if(do_delete){
            vec[h].erase(vec.begin(), h);
        }
    }
    
    for(int w=0; w<vec[0].size(); w++){
        bool do_delte = true;
        for(int h=0; h<vec.size(); h++){
            if(vec[h][w] != '.'){
                do_delete = false;
                break;
            }
        }
        
        if(do_delete){
            vec.erase(vec.begin(), w);
        }
    }
    
    for(int h=0; h<vec.size(); h++){
        for(int w=0; w<vec[h].size(); w++){
            printf("%c", vec[h][w]);
        }
        printf("\n");
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: no matching function for call to 'std::vector<char>::erase(std::vector<std::vector<char> >::iterator, int&)'
   28 |             vec[h].erase(vec.begin(), h);
      |             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/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 = char; _Alloc = std::allocator<char>; iterator = std::vector<char>::iterator; const_iterator = std::vector<char>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note:   candidate expects 1 argument, 2 provided
/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 = char; _Alloc = std::allocator<char>; iterator = std::vector<char>::iterator; const_iterator = std::vector<char>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:28: note:   no known conversion for argument 1 from '__normal_iterator<std::vector<char>*,vector<std::vector<char>>>' to '__normal_iterator<const char*,vector<char>>'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |             ~~~~~~~~~~~~~~~^~~~~~~
a.cc:36:17: error: 'do_delete' was not declared in this scope; did you mean 'do_delte'?
   36 |                 do_delete = false;
      |                 ^~~~~~~~~
      |                 do_delte
a.cc:41:12: error: 'do_delete' was not declared in this scope; did you mean 'do_delte'?
   41 |         if(do_delete){
      |            ^~~~~~~~~
      |            do_delte
a.cc:42:22: error: no matching function for call to 'std::vector<std::vector<char> >::erase(std::vector<std::vector<char> >::iterator, int&)'
   42 |             vec.erase(vec.begin(), w);
      |             ~~~~~~~~~^~~~~~~~~~~~~~~~
/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:7: note:   candidate expects 1 argument, 2 provided
/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:52: note:   no known conversion for argument 2 from 'int' to 'std::vector<std::vector<char> >::const_iterator'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |                                     ~~~~~~~~~~~~~~~^~~~~~