UVa 445 - Marvelous Mazes

445 - Marvelous Mazes

 * http://acm.uva.es/p/v4/445.html

Summary
Summary of the problem statement goes here.

Explanation
Explanation of the ideas behind the solution goes here.

Gotchas

 * Any points one can easily overlook?
 * The correct way to understand ambiguous formulations?

Implementations
Notes/Hints on actual implementation here.

Optimizations
Optimizations here.

Input
1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T!

11X21b1X! 4X1b1X!

3X3b3X1b1X5b1X1b1X2b1X3b1X2b1X1b4X1b4X1b1X3b3X 1b1X4b1X1b1X1b1X2b1X2b1X1b2X1b1X3b2X1b1X1b1X2b1X1b1X2b1X1b3X2b1X 1b1X4b3X2b1X1b1X1b1X2b1X1b2X3b1X1b2X1b1X2b1X1b1X2b1X1b1X1b1X3b1X 3X3b1X5b1X1b1X3b1X2b1X3b1X2b1X1b4X1b4X1b3X1b3X

3O3b3O1b1O5b1O1b1O2b1O3b1O2b1O1b4O1b4O1b1O3b3O 1b1O4b1O1b1O1b1O2b1O2b1O1b2O1b1O3b2O1b1O1b1O2b1O1b1O2b1O1b3O2b1O 1b1O4b3O2b1O1b1O1b1O2b1O1b2O3b1O1b2O1b1O2b1O1b1O2b1O1b1O1b1O3b1O 3O3b1O5b1O1b1O3b1O2b1O3b1O2b1O1b4O1b4O1b3O1b3O

Output
T TTTTT T T TT T T  TT T   T T TTT   T T   T T TTTTT*T

XX  X

XXXX X

XXX  XXX X     X X  X   X  X XXXX XXXX X   XXX X   X X X  X  X XX X   XX X X  X X  X XXX  X X    XXX  X X X  X XX   X XX X  X X  X X X   X XXX   X     X X   X  X   X  X XXXX XXXX XXX XXX

OOO  OOO O     O O  O   O  O OOOO OOOO O   OOO O   O O O  O  O OO O   OO O O  O O  O OOO  O O    OOO  O O O  O OO   O OO O  O O  O O O   O OOO   O     O O   O  O   O  O OOOO OOOO OOO OOO