No.455 Winter Triangle
Note
This problem was created as the Day 6 problem of Advent Calendar Contest Advent Calendar 2016.
Problem Statement
One day in December, you happen to look up at the night sky and see it filled with stars.
Y-kun searched among them for the three stars that form the "Winter Triangle",
but he just cannot find the last one.
Now, you are given the state of a night sky of height $H$ and width $W$,
in which only the two stars Y-kun found exist.
Add one star to this night sky at a position such that connecting the three stars forms a triangle.
A triangle of any shape will be accepted.
Addendum: It is guaranteed that at least one solution exists.
Supplement
Connecting the three stars forms a triangle refers to states such as the following.
Note: '*' represents a star, and '-' represents nothing.
---------*-- -*---------- ------------ ---------*--
*----------- *----------- ------------ -*----------
If the three stars lie on a single straight line, they do not form a triangle.
----*------- ----*------- ------------ ----*-------
-*---------- ----*------- ------------ ----------*-
Input
$H$ $W$ $S_1$ $S_2$ $\vdots$ $S_H$
The first line contains the vertical size $\,H$ and the horizontal size $\,W\,$ of the night sky.
The following $H$ lines give the state of the night sky Y-kun saw, as strings $S_i$ of length $W$.
$S_i$ consists only of '*', representing a star, and '-', representing nothing.
It is guaranteed that there are exactly two stars.
- $H,W$ are integers
- $2 \le H,W \le 100$
Output
Output the state of the night sky after adding one star at a position such that the three stars form a triangle,
in the same way as the input, as $H$ lines of strings of length $W$.
Print a newline at the end.
Sample
Sample 1
Input
4 10 ---------- -------*-- --*------- ----------
Output
---------- -------*-- --*------- -------*--
This output is one example.
Sample 2
Input
6 2 -- *- -- -- -- *-
Output
-- *- -* -- -- *-
It is long and thin, but it is a triangle.
Sample 3
Input
12 50 -------------------------------------------------- ---------*---------------------------------------- -------------------------------------------------- -----------------------------------------*-------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
Output
-------------------------------------------------- ---------*---------------------------------------- -------------------------------------------------- -----------------------------------------*-------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------*----------------------------- --------------------------------------------------
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
くれちー
はむこ