I. 152. Write a program to recognize the following characters: see the Figure.
The file in.txt contains the characters to be recognized: white squares are encoded as 0's, while black squares as 1's. The input always contains letters of size 5×8, separated by two white columns. (There is no such white column before the first and after the last letter.) The input has more than one line, and every 8th line consists of entirely 0's as separators.
You should apply the following rules for recognition:
- If the input sign has a black dot at a certain position and some of the letters also have a black dot there, then the matching rate increases by 1.
- If the input sign has a black dot at a certain position and some of the letters do not have a black dot there, then the matching rate decreases by 1.
The input sign is identified as a certain letter, if the matching rate is at least 50% between the input and that letter. (Your output then is this letter.) If there are two candidates with equal matching rate, or the rate is less than 50%, your output should be a ``?''. The output file out.txt should contain the recognized letters or the question marks without spaces.
For example, if the input sign is the following:
so this character is recognized as letter ``B''.
The source code of the program (i152.pas, i152.cpp, ) should be submitted.
Deadline expired on 19 March 2007.