using System; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using Enu = System.Linq.Enumerable; public class Program { public void Solve() { int H = Reader.Int(), W = Reader.Int(); var grid = Reader.StringArray(H); var P = new List(); for (int y = 0; y < H; y++) for (int x = 0; x < W; x++) if (grid[y][x] == '*') P.Add(new Point(x, y)); var line = new Line(P[0], P[1]); for (int y = 0, found = 0; y < H && found == 0; y++) for (int x = 0; x < W; x++) if (grid[y][x] == '-' && !OnLine(new Point(x, y), line)) { grid[y] = grid[y].Remove(x, 1).Insert(x, "*"); found = 1; break; } Console.WriteLine(string.Join("\n", grid)); } public bool OnLine(Point p, Line line) { return (line.A - p).Det(line.B - p) == 0; } public class Line { public Point A, B; public Point this[int i] { get { if (i == 0) return A; if (i == 1) return B; throw new ArgumentException(); } } public Line(Point a, Point b) { Debug.Assert(a != b); A = a; B = b; } public override string ToString() { return A + " - " + B; } } public struct Point : IEquatable, IComparable { public long X, Y; public Point(long x, long y) { X = x; Y = y; } public static Point operator +(Point a, Point b) { return new Point(a.X + b.X, a.Y + b.Y); } public static Point operator -(Point a, Point b) { return new Point(a.X - b.X, a.Y - b.Y); } public long DistSquare(Point b) { return (X - b.X) * (X - b.X) + (Y - b.Y) * (Y - b.Y); } public double Dist(Point b) { return Math.Sqrt(DistSquare(b)); } public long Dot(Point b) { return X * b.X + Y * b.Y; } public long Det(Point b) { return X * b.Y - Y * b.X; } public bool Equals(Point b) { return X == b.X && Y == b.Y; } public override bool Equals(object obj) { return Equals((Point)obj); } public static bool operator ==(Point a, Point b) { return a.Equals(b); } public static bool operator !=(Point a, Point b) { return !a.Equals(b); } public int CompareTo(Point b) { return X != b.X ? Math.Sign(X - b.X) : Math.Sign(Y - b.Y); } public override int GetHashCode() { return (int)(X * 100000 + Y); } public override string ToString() { return X + ", " + Y; } } } class Entry { static void Main() { new Program().Solve(); } } class Reader { static TextReader reader = Console.In; static readonly char[] separator = { ' ' }; static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries; static string[] A = new string[0]; static int i; static void Init() { A = new string[0]; } public static void Set(TextReader r) { reader = r; Init(); } public static void Set(string file) { reader = new StreamReader(file); Init(); } public static bool HasNext() { return CheckNext(); } public static string String() { return Next(); } public static int Int() { return int.Parse(Next()); } public static long Long() { return long.Parse(Next()); } public static double Double() { return double.Parse(Next()); } public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); } public static int[] IntArray(int N) { return Range(N, Int); } public static int[][] IntTable(int H) { return Range(H, IntLine); } public static string[] StringArray(int N) { return Range(N, Next); } public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); } public static string Line() { return reader.ReadLine().Trim(); } public static T[] Range(int N, Func f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; } static string[] Split(string s) { return s.Split(separator, op); } static string Next() { CheckNext(); return A[i++]; } static bool CheckNext() { if (i < A.Length) return true; string line = reader.ReadLine(); if (line == null) return false; if (line == "") return CheckNext(); A = Split(line); i = 0; return true; } }