← 返回 meta 的题目列表Maze Solver: Print a Maze With Empty Cells Marked
类型:online_judge
Problem: Print a Maze (mark empty cells with *)
Given a 2D character maze grid of size R x C. Each cell is either a wall #, a walkable empty space ' ' (blank), or other walkable characters.
Implement a maze printing routine that outputs the same maze, but replaces every blank space ' ' with * when printing. All other characters must remain unchanged.
Input
Line 1: two integers R C
Next R lines: strings of length C representing the maze
In this stdin format, . represents a blank space (since raw spaces are hard to see)
Output
Print R lines of length C
Every . cell must be printed as *
Constraints
1 <= R, C <= 200
Example
Input:
3 5
#####
#...#
#####
Output:
#####
#***#
#####
Example
Input
3 5
#####
#...#
#####
Output
#####
#***#
#####