Woburn Challenge 2001
Losing the office pools would be an intelligence failure that would certainly cost M her job as chief of MI6. Resorting to means employed during the cold war, she decides to take action on several fronts. She decides to foment a revolution on Survivor Island to kick out the current dominant player and install her choice (Amber) as the winner of Survivor. She quickly deploys John Patrick Mason (a crack commando of the Special Air Service, SAS), a veteran of inserting onto ex-prison islands (his last mission was on Alcatraz). His job would be to infiltrate Survivor Island (Australia) and take the necessary measures to ensure that the "right" contestant would win.
Mason paradrops onto the island at night at a designated coordinate and
inexplicably blurts out to no one in particular, "Welcome to the Rock."
He has been provided with a rather strange map to the main camp. At each
coordinate on the map, a number is listed
Consider the island to be an

Figure 1
Input Specification
The first line contains
Output Specification
For each starting position, describe the path that Mason follows by outputting the labels of the positions he walks along in the format shown below.
Sample Input
5 5
ABCDE
GGHIJ
LLMNO
GQRST
UVWXY
96666
32222
91222
89222
94444
1 1
1 2
2 5
3 3
2 1
Sample Output
A
BCDE
JOTYX then WVUQMR repeated
MRWVUQ repeated
G then LGLG repeated
Note: We are interested in knowing about how the path loops, not
how the ASCII string loops: so for the fifth sample test case, GL
repeated
, G then LG repeated
, GLGL repeated
, and
G then LGLGLGLG repeated
would all be wrong.
Comments