You find yourself trapped in a maze and must find your way out, you are given a two dimensional array containing characters that represents the maze. But since there are multiple types of characters representing the walls of the maze and more representing the path of the maze it is almost undecipherable. That is until you notice the key at the top of the map. You look at this string of characters and notice that they are the most used in the array and surmise that these are the characters defining the walls. And that after the string there are two numbers, after carefully counting the dimensions of the array you determine that these are representing the width and height of the maze. As an added bonus you notice in very small print at the bottom that no map of a maze produced by this company is more than 30 units wide by 30 units tall and all are guaranteed to have only one solution and only one maze per input map or your money back. The 'X' and 'S' characters will never show in the list of wall characters either.
You also notice the big 'S' that is where you entered the map and since the 'X' is only used in one spot you guess that the 'S' is the start and the 'X' is the exit.
Your job should you choose not to rot in the maze and become a zombie is to write a computer program that takes in these characters and the maze array and finds a path out of the maze. Your output should be a new map that you can easily follow and that does not contain the paths that don't lead directly to the exit. So it would be easy to follow you decide to use the '#' character to define walls the '.' character to define the floors and the '*' character to define your path.
Input Format1234567890-=!@$%^&()_QVWERTYUIOP[]{}|ADFGHJKL;ZCVBNM<>/?#
10 10
-=-=-=-=-=
S+*.*.-+*-
-=-=-,-.-=
-.,.=+-*+-
=+=.++,-*-
=*.=,-.+*-
=+=-.-=-=-
--,=,=,+,-
=+.+,+.=.-
-=-=-=-=X-
##########
S*****#..#
#####*#.##
#...#*#..#
#.#.**.#.#
#..#*#...#
#.##*#####
##.#*#***#
#...***#*#
########X#