The following mapping from letters to digits is given:

E | J N Q | R W X | D S Y | F T | A M | C I V | B K U | L O P | G H Z
e | j n q | r w x | d s y | f t | a m | c i v | b k u | l o p | g h z
0 |   1   |   2   |   3   |  4  |  5  |   6   |   7   |   8   |   9

Mapping for encoding telephone numbers by words, so
that it becomes easier to remember the numbers.

Functional requirements

A program that finds, for a given phone number, all
possible encodings by words, and prints them. A phone number is an
arbitrary(!) string of dashes - , slashes / and digits. The dashes and
slashes will not be encoded. The words are taken from a dictionary which
is given as an alphabetically sorted ASCII file (one word per line).

[NOTE: The dictionary is in German and contains umlaut characters
encoded as double-quotes.  The double-quotes should be ignored.  EG.]

Only exactly each encoding that is possible from this dictionary and
that matches the phone number exactly shall be printed. Thus, possibly
nothing is printed at all. The words in the dictionary contain letters
(capital or small, but the difference is ignored in the sorting), dashes
- and double quotes " . For the encoding only the letters are used, but
the words must be printed in exactly the form given in the dictionary.
Leading non-letters do not occur in the dictionary.

Encodings of phone numbers can consist of a single word or of multiple
words separated by spaces. The encodings are built word by word from
left to right. If and only if at a particular point no word at all from
the dictionary can be inserted, a single digit from the phone number can
be copied to the encoding instead. Two subsequent digits are never
allowed, though. To put it differently: In a partial encoding that
currently covers k digits, digit k+1 is encoded by itself if and only
if,
first, digit k was not encoded by a digit and, second, there is no word
in the dictionary that can be used in the encoding starting at digit
k+1.

Your program must work on a series of phone numbers; for each encoding
that it finds, it must print the phone number followed by a colon, a
single(!) space, and the encoding on one line; trailing spaces are not
allowed. All remaining ambiguities in this specification will be
resolved by the following example. (Still remaining ambiguities are
intended degrees of freedom.)

Sample dictionary:

an
blau
Bo"
Boot
bo"s
da
Fee
fern
Fest
fort
je
jemand
mir
Mix
Mixer
Name
neu
o"d
Ort
so
Tor
Torf
Wasser

Sample phone number list:

112
5624-82
4824
0721/608-4067
10/783--5
1078-913-5
381482
04824

Corresponding correct program output (on screen):
5624-82: mir Tor
5624-82: Mix Tor
4824: Torf
4824: fort
4824: Tor 4
10/783--5: neu o"d 5
10/783--5: je bo"s 5
10/783--5: je Bo" da
381482: so 1 Tor
04824: 0 Torf
04824: 0 fort
04824: 0 Tor 4

Any other output would be wrong (except for different ordering of the
lines).

Wrong outputs for the above example would be e.g.

562482: Mix Tor, because the formatting of the phone number is
incorrect,

10/783--5: je bos 5, because the formatting of the second word is
incorrect,

4824: 4 Ort, because in place of the first digit the words Torf, fort,
Tor could be used,

1078-913-5: je Bo" 9 1 da , since there are two subsequent digits in the
encoding,

04824: 0 Tor , because the encoding does not cover the whole phone
number, and

5624-82: mir Torf , because the encoding is longer than the phone
number.


Quantitative requirements

Length of the individual words in the dictionary: 50 characters maximum.
Number of words in the dictionary: 75000 maximum
Length of the phone numbers: 50 characters maximum.
Number of entries in the phone number file: unlimited.


A large dictionary, which you can use for testing purposes, is available
at dictionary.txt.
Cubes Puzzle Task

Creates a computer program that solves the given cubes puzzles and
prints the solution(s) in ASCII format into a file in unfolded format
as given below as an example.

Have a look at the following link for some background information:
http://www.happycube.com/

Here is an example:
The pieces of the blue cube look as follows:
  o  o o o  o  
 ooo ooooo oooo
ooooo ooo oooo 
 ooo ooooo oooo
  o  o o o  o  
 o o  o o  o o 
oooo ooooo oooo
 oooo ooo oooo 
oooo ooooo oooo
oo o o o  oo oo

One of the solutions in "unfolded form" looks as follows:
  o    o o o o 
 ooo ooooo ooo 
ooooo ooo ooooo
 ooo ooooo ooo 
  o   o oo  o  
     o o       
     ooooo     
      ooo      
     ooooo     
      o o      
     o o o     
     ooooo     
      ooo      
     ooooo     
     o o o     
      o o      
     oooo      
      oooo     
     oooo      
     oo o