#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int width;     int height;     cin >> height;     cin >> width;     char art[height][width];     for (int i = 0; i < height; i++) {       for (int k = 0; k < width; k++) {         cin >> art[i][k];       }     }     bool found_content = false;     int max_width = width - 1;     int min_width = 0;     int max_height = height - 1;     int min_height = 0;     int collumn = 0;     while (!found_content) {       for (int i = 0; i < height && !found_content; i++) {         if (art[i][collumn] ==  * ) {           min_width = collumn;           found_content = true;         }       }       collumn++;     }     found_content = false;     collumn = width - 1;     while (!found_content) {       for (int i = 0; i < height && !found_content; i++) {         if (art[i][collumn] ==  * ) {           max_width = collumn;           found_content = true;         }       }       collumn--;     }     found_content = false;     int row = 0;     while (!found_content) {       for (int i = 0; i < width && !found_content; i++) {         if (art[row][i] ==  * ) {           min_height = row;           found_content = true;         }       }       row++;     }     found_content = false;     row = height - 1;     while (!found_content) {       for (int i = 0; i < width && !found_content; i++) {         if (art[row][i] ==  * ) {           max_height = row;           found_content = true;         }       }       row--;     }     for (int r = min_height; r <= max_height; r++) {       for (int c = min_width; c <= max_width; c++) {         cout << art[r][c];       }       cout <<   n ;     }   }   