Remittance Slip Digit Recognition
Your customer's bank returns remittance slips as flat text: the 9-digit payment reference is printed as seven-segment ASCII art across three rows, and the scanner occasionally drops or adds a single stroke. Your job is the recognition pipeline distilled to its core algorithm: read the digits, validate the weighted check digit, and — when a scan is broken — work out whether exactly one single-segment repair can rescue it or whether the slip must go to a human.
Requirements
Create a codeunit named "Payment Slip OCR" with three public procedures:
procedure RecognizeDigits(Top: Text; Middle: Text; Bottom: Text): Text
procedure HasValidCheckDigit(Reference: Text): Boolean
procedure Scan(Top: Text; Middle: Text; Bottom: Text): TextThe slip format
Each scan arrives as three rows of exactly 27 characters containing only spaces, underscores (_), and pipes (|).
Cell i (1..9, left to right) is columns 3i-2 to 3i of all three rows — a 3×3 block of 9 characters.
The canonical renderings of the ten digits, 0 through 9, three columns per digit:
_ _ _ _ _ _ _ _
| | | _| _||_||_ |_ ||_||_|
|_| ||_ _| | _||_| ||_| _|A full scan of the reference 123456789 looks like this:
_ _ _ _ _ _ _
| _| _||_||_ |_ ||_||_|
||_ _| | _||_| ||_| _|RecognizeDigits
Return exactly 9 characters, one per cell, left to right.
A cell that matches a canonical digit rendering exactly (all 9 characters) becomes that digit; any other cell becomes ?.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 15 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in