Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Error-correct text

Correct a single-letter typo in a fixed text.

Input: The paragraph below but with exactly one typo, where a single letter a-zA-Z is replaced by a different letter a-zA-Z. To be clear, the letter isn't replaced everywhere it appears, but just in that one place. For example, the first word "In" might become "IZ". Non-letter characters like spaces or punctuation cannot be affected.

Output: The paragraph exactly as below, without the typo. A trailing newline is OK.

In information theory and coding theory with applications in computer science and telecommunication, error detection and correction or error control are techniques that enable reliable delivery of digital data over unreliable communication channels. Many communication channels are subject to channel noise, and thus errors may be introduced during transmission from the source to a receiver. Error detection techniques allow detecting such errors, while error correction enables reconstruction of the original data in many cases.

TIO with text

The text is taken from the Wikipedia article Error detection and correction. But, your code may not fetch the text from Wikipedia or elsewhere, as per the standard loophole.

Any site-default string I/O is acceptable. Fewest bytes wins. Please check that your solution works for all 23001 possible inputs, if you're able to run that much.

Answer*

Draft saved
Draft discarded
Cancel
6
  • 1
    \$\begingroup\$ @JonathanAllan yes I have, will post the collision check soon \$\endgroup\$ Commented Mar 9, 2020 at 3:09
  • \$\begingroup\$ Snap! Will do, thanks for pointing it out. \$\endgroup\$ Commented Mar 9, 2020 at 3:32
  • 1
    \$\begingroup\$ If the hash is indeed 64 bits and roughly random, it seems very likely it will give no false matches with two-character changes, but a check would indeed be good. \$\endgroup\$ Commented Mar 9, 2020 at 3:34
  • 1
    \$\begingroup\$ @JonathanAllan took a long time, but I checked and all inputs return the correct output. \$\endgroup\$ Commented Mar 9, 2020 at 4:28
  • 1
    \$\begingroup\$ Assuming sufficiently high recursion limit and stack size, you can write it as a recursive function for 98 bytes. Can't show examples in this TiO link, because it will exceed the character limit of this comment. \$\endgroup\$ Commented Mar 9, 2020 at 10:23

AltStyle によって変換されたページ (->オリジナル) /