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 as5
O
is misinterpreted as0
I
is misinterpreted as1
The test cases contain numbers only by mistake.
def correct(string):
pass
def correct(string):
mis = {"0":"O", "5":"S", "1":"I"}
for c in string:
if c in mis:
string = string.replace(c, mis[c])
return string
def correct(string):
return string.translate(str.maketrans("501", "SOI"))
def correct(string):
return string.replace('1','I').replace('0','O').replace('5','S')