Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
  	int H,W;
  	cin>>H>>W;
  	string s(H,W);
  	for(int i=0;i<H;++i){
    	for(int j=0;j<W;++j)cin>>s[i][j];
    }for(int i=0;i<H;++i){int count=0;
    	for(int j=0;j<W;++j)if(s[i][j]=='.')++count;
      	if(count==W)s.erase(s[i].begin(),s[i].end());
    }for(int j=0;j<W;++j){int count2=0;
    	for(int i=0;i<s[j].size();++i)if(s[i][j]=='.')++count2;
      	if(count2==s[j].size())s.erase(s[j].begin(),s[j].end());
    }cout<<s<<endl;return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
   10 |         for(int j=0;j<W;++j)cin>>s[i][j];
      |                                      ^
a.cc:12:36: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
   12 |         for(int j=0;j<W;++j)if(s[i][j]=='.')++count;
      |                                    ^
a.cc:13:34: error: request for member 'begin' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   13 |         if(count==W)s.erase(s[i].begin(),s[i].end());
      |                                  ^~~~~
a.cc:13:47: error: request for member 'end' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   13 |         if(count==W)s.erase(s[i].begin(),s[i].end());
      |                                               ^~~
a.cc:15:28: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   15 |         for(int i=0;i<s[j].size();++i)if(s[i][j]=='.')++count2;
      |                            ^~~~
a.cc:15:46: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
   15 |         for(int i=0;i<s[j].size();++i)if(s[i][j]=='.')++count2;
      |                                              ^
a.cc:16:25: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   16 |         if(count2==s[j].size())s.erase(s[j].begin(),s[j].end());
      |                         ^~~~
a.cc:16:45: error: request for member 'begin' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   16 |         if(count2==s[j].size())s.erase(s[j].begin(),s[j].end());
      |                                             ^~~~~
a.cc:16:58: error: request for member 'end' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   16 |         if(count2==s[j].size())s.erase(s[j].begin(),s[j].end());
      |                                                          ^~~