1009: All the paths in a rectangle grid
[Creator : ]
Description
Given a M x N rectangle grid with English letters, please output all the path from cell (1,1) to cell (M, N); you can only move down or move right only and not moving up or left. please output the path in ascending order!
( 0 <= M*N <= 20 )
( 0 <= M*N <= 20 )
Input
The first line contains two integers M and N
then there are M lines and each line with N letters
then there are M lines and each line with N letters
Output
All the paths in ascending order; one path one line
Sample Input Copy
2 3
A D F
C B K
Sample Output Copy
ACBK
ADBK
ADFK