using System; using System.Collections.Generic; using System.Linq; public class Program { public static void Main() { var data = Console.ReadLine().Split(' '); int H = int.Parse(data[0]); int W = int.Parse(data[1]); var maps = new Maps(); for (int i = 0; i < H; i++) { int w = Console.ReadLine().IndexOf('*'); if (w >= 0) { maps.Map.Add(new Map { H = i, W = w }); } } var map = maps.Search(H, W); if (map != null) { maps.Map.Add(map); } for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (maps.Map.Any(x => x.H == i && x.W == j)) { Console.Write("*"); } else { Console.Write("-"); } } Console.WriteLine(); } } } public class Maps { public List Map { get; set; } public Maps() { Map = new List(); } public Map Search(int H, int W) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (IsConfirm(i, j)) { return new Map { H = i, W = j }; } } } return null; } public bool IsConfirm(int h, int w) { var slope = new List(); foreach (var item in Map) { slope.Add(GetSlope(item, h, w)); } return slope.Count() == slope.Distinct().Count(); } public string GetSlope(Map map, int hh, int ww) { decimal h = map.H - hh; decimal w = map.W - ww; if (w == 0) { return "∞"; } if (h == 0) { return "0"; } return (h / w).ToString(); } } public class Map { public int H { get; set; } public int W { get; set; } }