SP14947 SANTA3 - Breaking and Entering
Description
Santa's favourite part of Christmas is, of course, entering people's houses through their fireplaces at night and leaving them presents. On this occasion, he's visiting a house which can be modeled as a rectangular grid of cells, with $ R $ ( $ 1 \leq R \leq 100 $ ) rows and $ C $ ( $ 1 \leq C \leq 100 $ ) columns. Each cell is either empty (represented by a '.'), contains a wall ('#'), contains a fireplace ('F'), contains a stocking of a certain size ('1'..'9'), or is empty but initially contains a dog facing in a certain direction (with up represented by '^', right by '>', down by 'v', and left by '
Input Format
First line: $ R $ and $ C $
Next $ R $ lines: $ C $ characters, representing the $ i $ th row of the grid as described above, for $ i=1..R $
Next line: $ M $ and $ P $
Next line: $ M $ characters, representing Santa's moves
Output Format
$ R $ lines: $ C $ characters, representing the distribution of presents in the $ i $ th row of the grid as described above, for $ i=1..R $
Next line: The row and column of the last cell which Santa will visit