## DWITE '09 R5 #4 - Kind of like OCR

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 64M

Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### DWITE Online Computer Programming Contest, March 2010, Problem 4

Optical Character Recognition (OCR) is the process of extracting textual information from images. While the current technology is mostly software based, rather than using optical devices, the term has stuck around.

For the problem we'll work with a very simple alphabet, each letter strictly defined by a 2x2 or 3x2 bitmap.

A - x.
xx

B - xx
xx

C - x.x
xxx

D - xx
.x

E - xxx
.xx


The input will contain 5 sets, each 2 lines long, at least 2 and no longer than 30 characters long. A set will spell out some word in the above alphabet. It will always be a valid word, and it will not be ambiguous (in a way that only one possible word could make the design pattern).

The output will contain 5 lines of output -- the recognized words.

Note: you would need to take a word as a whole to distinguish between some of the cases. For example: in the below sample, while the first character could be read as C, the rest of the word would not be made of valid characters.

#### Sample Input

x.x.x
xxxxx
x.x.xx
xxxxxx

#### Sample Output

AC
AAB