import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int H = sc.nextInt(); final int W = sc.nextInt(); boolean[][] block = new boolean[H][W]; for(int i = 0; i < H; i++){ final char[] ins = sc.next().toCharArray(); for(int j = 0; j < W; j++){ block[i][j] = ins[j] == '*'; } } int fst_x = -1, fst_y = -1, snd_x = -1, snd_y = -1; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ if(!block[i][j]){ continue; } if(fst_x < 0){ fst_x = j; fst_y = i; }else{ snd_x = j; snd_y = i; } } } if(H * W <= 4){ LOOP: for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ if(block[i][j]){ continue; } block[i][j] = true; break LOOP; } } }else{ if(fst_x == snd_x){ block[fst_y][(snd_x + 1) % W] = true; }else if(fst_y == snd_y){ block[(fst_y + 1) % H][snd_x] = true; }else if(fst_x < snd_x && fst_y < snd_y){ block[snd_y][fst_x] = true; }else if(snd_x < fst_x && snd_y < fst_y){ block[snd_y][fst_x] = true; }else{ block[snd_y][fst_x] = true; } } for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ System.out.print(block[i][j] ? "*" : "-"); } System.out.println(); } } }