CODE WARS ]I[ PROGRAMMING COMPETITION
Maze Surfing
Problem 13 Division I 14 Points
Problem Statement
You dirty rat. You're caught in a malicious lab experiment, dropped into a maze. Your job is to find the cheese and thereby to prove the superior intelligence of the various rodent species.
Program Input
The input file PROG13.IN describes a single maze. The first line of the file is an integer, N, indicating the number of rows and columns in the maze, constrained by: 8 < N < 19. The next N lines each contain N characters separated by spaces. Walls are represented by '#', hallways by '.', the start position by 'M', and the cheese by 'C'. For example:
10
# # # # # # # # # #
# . # M . . # . . #
# . # # . # # # . #
# . . . . . . . . #
# # # # . # . # # #
# . . . . # . # C #
# # # # # # . # . #
# . # . . . . # . #
# . . . # . . . . #
# # # # # # # # # #
Program Output
The program should write the maze to PROG13.OUT, drawing the shortest path from M to C with a series of '+' characters.  You may assume that (1) there will be a valid path from M to C, and (2) there will only be one path from M to C (i.e., no loops).  The path is not permitted to contain any diagonal movements.  The solution for the above input file is:
# # # # # # # # # #
# . # M + . # . . #
# . # # + # # # . #
# . . . + + + . . #
# # # # . # + # # #
# . . . . # + # C #
# # # # # # + # + #
# . # . . . + # + #
# . . . # . + + + #
# # # # # # # # # #