($h,$w)=glob<>; for$y(0..$h-1){ push@a,$_=<>; for$x(0..$w-1){ if(substr($_,$x,1)eq'*'){ $y2=$y1;$y1=$y; $x2=$x1;$x1=$x; } } } for$y(0..$h-1){ for$x(0..$w-1){ if(($y-$y1)*($x-$x2)!=($y-$y2)*($x-$x1)){ substr$a[$y],$x,1,'*'; print@a; exit; } } }