Correct the mistakes of the character recognition software

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5168

    #1

    Correct the mistakes of the character recognition software

    Instructions:

    Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer.


    When documents (especially pretty old ones written with a typewriter), are digitised character recognition softwares often make mistakes.


    Your task is correct the errors in the digitised text. You only have to handle the following mistakes:


    S is misinterpreted as 5

    O is misinterpreted as 0

    I is misinterpreted as 1

    The test cases contain numbers only by mistake.


    Solution



    Output




    Thoughts:

    I have used the replaceAll() string function to replace all 5s, 1s and 0s to S, I and O. And functional chaining to have a concise and readable code.


    This is a CodeWars Challenge of 8kyu Rank (https://www.codewars.com/kata/577bd0...ain/javascript)




    More...
Working...