12922 - Where's Wally?   

Description

Given a 7 times 7 character board. Please find the word “WALLY” that can be formed by a sequence of adjacent characters on the board and highlight all alphabets in the sequence.

Note that:

  1. It might not has a solution or has one(more than one) solution.
  2. Allow to search eight possible directions.

Input

A word puzzle map.

Note that:

  1. Use Capital letter ‘A~Z’ to represent alphabets inside the map.
  2. Use ‘-’ to hide the alphabets which are not a solution.
  3. Need a ‘Space’ between any two characters.

 

// Possible puzzle map

Z C G C O T Q

J W B C W E W

J Z A L L R R

H Q K A Y M F

K T W L P G H

Q D P G E G J

Q S V C C Y Z

 

// Puzzle solved map

- - - - - - -

- W - - - - -

- - A L L - -

- - - A Y - -

- - W - - - -

- - - - - - -

- - - - - - -

Output

Output should follow below format:

c c c c c c c

c c c c c c c

c c c c c c c

c c c c c c c

c c c c c c c

c c c c c c c

Note that:

  1. Need to have a return value('\n') at the end of your string.
  2. Character c is one of ‘-’, ‘W’, A’, L’, ‘Y’.

Sample Input  Download

Sample Output  Download

Tags




Discuss