~/algor $ cat problems/3Lbk8bFKI4qi
Through the walls
On a map of rows and columns, . is an empty cell and # is a wall. A robot must get from the top-left cell to the bottom-right cell. In one step it moves to an adjacent (up, down, left or right) cell; before entering a cell with a wall it breaks that wall. What is the smallest number of walls the robot has to break?
Input
The first line contains two positive integers: and . Each of the next lines contains a string of characters (. or #).
Output
One integer — the number of broken walls.
Note
the top-left and bottom-right cells are empty
Examples
4 5 ..#.. ##.#. .#.## .#...
1
3 3 .#. ### .#.
2