• A 5!mPI_E OCR Puzzle

    From Carl G.@carlgnews@microprizes.com to rec.puzzles on Tue Oct 21 10:49:43 2025
    From Newsgroup: rec.puzzles

    An OCR Puzzle.

    I once wrote software that would try to "clean up" OCR text based on
    something I knew about the data (e.g., the characters were supposed to
    be coordinates).

    Here is a "5!mPI_E" puzzle based on writing such a program. Assume that
    the text below is a message that was written by hand using only the
    digits 0 to 9 and spaces. The original message was encrypted into 7-bit
    ASCII numbers separated by spaces (e.g., "99 97 116" represents "cat").
    The message was then scanned using OCR. Unfortunately, the OCR had
    trouble distinguishing between similar characters (e.g., reading "Q"
    instead of "0", or "g" instead of "9") and sometimes missed or added
    spaces. Your challenge is to write a short computer program that
    reveals the original message (i.e., figures out the ASCII numbers, then
    turns the ASCII into text). The OCR text is between quotes:

    "6G I O132 |1 $ [I7i1#10I 3z li6![ ]32i0o 1i4 !OSl1Oio~/ 32 1Zl 1lI
    !i7 [ ]H32 ~/9|18 gT i0& 1 16 lO5 i]o IQ]"

    If your code works out the message, DON'T POST THE MESSAGE, just post
    your code that converts the OCR text into the solution. This will help prevent "spoilers". Extra points for using a more-esoteric computer
    language (INTERCAL, LISP, FORTH, etc.), a very short program (e.g., a one-liner or grep expression), or something that looks inexplicable.
    --
    Carl G.

    --
    This email has been checked for viruses by AVG antivirus software.
    www.avg.com
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ilan Mayer@user4643@newsgrouper.org.invalid to rec.puzzles on Wed Oct 22 02:34:09 2025
    From Newsgroup: rec.puzzles


    "Carl G." <carlgnews@microprizes.com> posted:

    An OCR Puzzle.

    I once wrote software that would try to "clean up" OCR text based on something I knew about the data (e.g., the characters were supposed to
    be coordinates).

    Here is a "5!mPI_E" puzzle based on writing such a program. Assume that
    the text below is a message that was written by hand using only the
    digits 0 to 9 and spaces. The original message was encrypted into 7-bit ASCII numbers separated by spaces (e.g., "99 97 116" represents "cat").
    The message was then scanned using OCR. Unfortunately, the OCR had trouble distinguishing between similar characters (e.g., reading "Q"
    instead of "0", or "g" instead of "9") and sometimes missed or added
    spaces. Your challenge is to write a short computer program that
    reveals the original message (i.e., figures out the ASCII numbers, then turns the ASCII into text). The OCR text is between quotes:

    "6G I O132 |1 $ [I7i1#10I 3z li6![ ]32i0o 1i4 !OSl1Oio~/ 32 1Zl 1lI
    !i7 [ ]H32 ~/9|18 gT i0& 1 16 lO5 i]o IQ]"

    If your code works out the message, DON'T POST THE MESSAGE, just post
    your code that converts the OCR text into the solution. This will help prevent "spoilers". Extra points for using a more-esoteric computer language (INTERCAL, LISP, FORTH, etc.), a very short program (e.g., a one-liner or grep expression), or something that looks inexplicable.


    The following C# program decodes this message:

    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace ConvertToAscii
    {
    class ConvertToAscii
    {
    static private List<string> characters =
    new List<string> { "OQo", "Iil!|[]", "Zz", "", "H#", "S$", "G", "T~", "&", "g" };

    static void Main(string[] args)
    {
    if (args.Length == 1)
    {
    ConvertText(args[0]);
    }
    else
    {
    Console.WriteLine("Usage: ConvertToAscii <Text string with ASCII codes>");
    }
    }

    static private void ConvertText(string text)
    {
    int number = 0;
    StringBuilder ascii = new StringBuilder();

    for (int n = 0; n < text.Length; n++)
    {
    char letter = text[n];
    if (letter == ' ')
    {
    if (number >= 32)
    {
    ascii.Append((char)number);
    number = 0;
    }
    }
    else
    {
    int digit;

    if (letter < '0' || letter > '9')
    {
    digit = DigitFromLetter(letter.ToString());
    }
    else
    {
    digit = letter - '0';
    }
    if (digit >= 0)
    {
    number = 10 * number + digit;
    }
    if (number >= 32)
    {
    ascii.Append((char)number);
    number = 0;
    }
    }
    }

    Console.WriteLine(ascii);
    }

    static private int DigitFromLetter(string letter)
    {
    for (int n = 0; n < characters.Count; n++)
    {
    if (characters[n].Contains(letter))
    {
    return n;
    }
    }

    return -1;
    }
    }
    }
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From HenHanna@NewsGrouper@user4055@newsgrouper.org.invalid to rec.puzzles on Wed Oct 22 03:49:53 2025
    From Newsgroup: rec.puzzles


    "Carl G." <carlgnews@microprizes.com> posted:

    An OCR Puzzle.

    I once wrote software that would try to "clean up" OCR text based on something I knew about the data (e.g., the characters were supposed to
    be coordinates).

    Here is a "5!mPI_E" puzzle based on writing such a program. Assume that
    the text below is a message that was written by hand using only the
    digits 0 to 9 and spaces. The original message was encrypted into 7-bit ASCII numbers separated by spaces (e.g., "99 97 116" represents "cat").
    The message was then scanned using OCR. Unfortunately, the OCR had trouble distinguishing between similar characters (e.g., reading "Q"
    instead of "0", or "g" instead of "9") and sometimes missed or added
    spaces. Your challenge is to write a short computer program that
    reveals the original message (i.e., figures out the ASCII numbers, then turns the ASCII into text). The OCR text is between quotes:

    "6G I O132 |1 $ [I7i1#10I 3z li6![ ]32i0o 1i4 !OSl1Oio~/ 32 1Zl 1lI
    !i7 [ ]H32 ~/9|18 gT i0& 1 16 lO5 i]o IQ]"

    If your code works out the message, DON'T POST THE MESSAGE, just post
    your code that converts the OCR text into the solution. This will help prevent "spoilers". Extra points for using a more-esoteric computer language (INTERCAL, LISP, FORTH, etc.), a very short program (e.g., a one-liner or grep expression), or something that looks inexplicable.






    "5!mPI_E" <--- i get it.




    99 corresponds to lowercase 'c'
    97 corresponds to lowercase 'a'
    116 corresponds to lowercase 't'

    Thus, the ASCII character codes 99, 97, and 116 stand for the letters forming the word "cat." This numerical encoding is a common way to represent text in computing and digital systems.

    So yes, "99 97 116" effectively encodes the word "cat" in ASCII [common knowledge].

    ________________

    i remember A and a as 61 and 41 (I mean backwards), and
    it's not [Common Knowledge] to me.... about 65 and 97.


    Maybe 65 and 97 were frequently used by Old-timer- programmers.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From HenHanna@NewsGrouper@user4055@newsgrouper.org.invalid to rec.puzzles on Wed Oct 22 06:01:53 2025
    From Newsgroup: rec.puzzles


    HenHanna@NewsGrouper <user4055@newsgrouper.org.invalid> posted:


    "Carl G." <carlgnews@microprizes.com> posted:

    An OCR Puzzle.

    I once wrote software that would try to "clean up" OCR text based on something I knew about the data (e.g., the characters were supposed to
    be coordinates).

    Here is a "5!mPI_E" puzzle based on writing such a program. Assume that the text below is a message that was written by hand using only the
    digits 0 to 9 and spaces. The original message was encrypted into 7-bit ASCII numbers separated by spaces (e.g., "99 97 116" represents "cat").
    The message was then scanned using OCR. Unfortunately, the OCR had trouble distinguishing between similar characters (e.g., reading "Q" instead of "0", or "g" instead of "9") and sometimes missed or added spaces. Your challenge is to write a short computer program that
    reveals the original message (i.e., figures out the ASCII numbers, then turns the ASCII into text). The OCR text is between quotes:

    "6G I O132 |1 $ [I7i1#10I 3z li6![ ]32i0o 1i4 !OSl1Oio~/ 32 1Zl 1lI
    !i7 [ ]H32 ~/9|18 gT i0& 1 16 lO5 i]o IQ]"

    If your code works out the message, DON'T POST THE MESSAGE, just post
    your code that converts the OCR text into the solution. This will help prevent "spoilers". Extra points for using a more-esoteric computer language (INTERCAL, LISP, FORTH, etc.), a very short program (e.g., a one-liner or grep expression), or something that looks inexplicable.






    "5!mPI_E" <--- i get it.




    99 corresponds to lowercase 'c'
    97 corresponds to lowercase 'a'
    116 corresponds to lowercase 't'

    Thus, the ASCII character codes 99, 97, and 116 stand for the letters forming the word "cat." This numerical encoding is a common way to represent text in computing and digital systems.

    So yes, "99 97 116" effectively encodes the word "cat" in ASCII [common knowledge].

    ________________

    i remember A and a as 61 and 41 (I mean backwards), and
    it's not [Common Knowledge] to me.... about 65 and 97.


    Maybe 65 and 97 were frequently used by Old-timer- programmers.



    SOrry if this isn't short or cryptic enough!!!


    ;;; ( in Gauche Scheme )


    (define (Repl str)
    (let ((tab (make-hash-table 'equal?)))
    (for-each (lambda (c) (hash-table-set! tab c #\1)) '(#\I #\i #\L #\[ #\] #\! #\| #\l))
    (for-each (lambda (c) (hash-table-set! tab c #\0)) '(#\Q #\O #\o))
    (for-each (lambda (p) (hash-table-set! tab (car p) (cdr p)))
    '((#\Z . #\2) (#\z . #\2) (#\H . #\4) (#\# . #\4) (#\S . #\5) (#\$ . #\5)
    (#\G . #\6) (#\T . #\7) (#\& . #\8) (#\g . #\9)))
    (string-map (lambda (c) (hash-table-ref/default tab c c)) str)))

    (define (a2c s)
    (let ((n (string-split s #\space )))
    (list->string (map (lambda (x) (integer->char (string->number x))) n))))

    (print (Repl S))
    (print (a2c (Repl S)))
    --- Synchronet 3.21a-Linux NewsLink 1.2