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.

Difficulty: introductory

Starter code:

def correct(string):
	

Solutions:
def correct(string):
    return string.translate(str.maketrans("501", "SOI"))

def correct(string):
    return string.replace('1','I').replace('0','O').replace('5','S')

tr=str.maketrans('015','OIS')

def correct(string):
    return string.translate(tr)

def correct(string):
    return string.replace('5','S').replace('0','O').replace('1','I')

def correct(s):
    return s.translate(str.maketrans("015", "OIS"))

def correct(strng):
    return strng.translate(strng.maketrans("501","SOI"))

def correct(s):
    mapping = str.maketrans({'0': 'O', '1': 'I', '5': 'S'})
    return s.translate(mapping)

def correct(string):
  return ''.join({'0':'O', '5':'S', '1':'I'}.get(c, c) for c in string)


def correct(string):
  cor=''
  for leter in string:
    if leter =='1':
      cor+='I'
    elif leter=='5':
      cor+='S'
    elif leter=='0':
      cor+='O'
    else:
      cor+=leter
  return cor

def correct(string):
    tr = {'0': 'O', '1' : 'I', '5':'S'}
    return ''.join([tr[i] if i.isdigit() else i for i in string])

def correct(string):
    return string.translate(bytes.maketrans(b"501",b"SOI"))

correct = lambda s: s.replace('5','S').replace('1','I').replace('0','O')

def correct(string):
    return string.translate(string.maketrans("501", "SOI"))

def correct(string):
    fixes = {'0': 'O', '5': 'S', '1': 'I'}
    issue = '015'
    result = ''
    for s in string:
        if s in issue:
            result += fixes[s]
        else:
            result += s
    return result


def correct(string):
    output = ""
    for letter in string:
        if letter == '5':
            output += 'S'
        elif letter == '0':
            output += 'O'
        elif letter == '1':
            output += 'I'
        else:
            output += letter
    return output

correct=lambda s: s.replace("5","S").replace("0","O").replace("1","I")

def correct(string):
    a = ''
    for x in string:
        if x == '5':
            a += 'S'
        elif x == '0':
            a += 'O'
        elif x == '1':
            a += 'I'
        else:
            a += x
    return a

def correct(string):
    for e, c in {'5':'S','0':'O','1':'I'}.items():
        string = string.replace(e,c)
    return string

def correct(s):
    return ''.join('S' if x == '5' else 'O' if x == '0' else 'I' if x == '1' else x for x in s)

def correct(string):
    d = dict(zip('015', 'OIS'))
    return ''.join(d.get(c, c) for c in string)

import re
def correct(string):
    return re.sub('(\d)', lambda x: {'5': 'S', '0': 'O', '1': 'I'}[x.group()], string)

def correct(string):
    corrected = {"0":"O", "1":"I", "3":"E", "5":"S", "7":"T"}

    for char in string:
        for num, alpha in corrected.items():
            if char == num:
                string = string.replace(char, alpha) 

    return string

def correct(string):
    for letter in (("5","S"),("0","O"),("1","I")):
        string = string.replace(*letter)
    return string

def correct(string):
    return ''.join([({'0':'O','5':'S','1':'I'}[ch] if ch in ['5','0','1'] else ch) for ch in string])

def correct(string):
    newList = []
    for i in list(string):
        if i == "0":
            newList.append("O")
        elif i == "5":
            newList.append("S")
        elif i == "1":
            newList.append("I")
        else:
            newList.append(i)
    return "".join(newList)

def correct(string):
    remap = {'5':'S','0':'O','1':'I'}
    return ''.join(x.replace(x,remap[x]) if x in remap else x for x in list(string))

def correct(string):
    string = string.replace('5','S',-1)
    string = string.replace('0','O',-1)
    string = string.replace('1','I',-1)
    return string

def correct(string):
    replace = {'5':'S', '0':'O', '1':'I'}
    for key, value in list(replace.items()):
        string = string.replace(key, value)
    return string


def correct(string):
    for strings in string:
        if strings.isdigit():
            string = string.replace("5","S")
            string = string.replace("0","O")
            string = string.replace("1","I")
    return string


def correct(string):
    dict = {'0': 'O', '1': 'I', '5': 'S'}
    output = ''
    for x in string:
        if x.isdigit():
            output += dict[x]
        else:
            output += x
    return output

def correct(string):
    matches = "501"
    for char in string:
        if char in matches:
            if char == "5":
                string = string.replace(char, "S")
            if char == "0":
                string = string.replace(char, "O")
            if char == "1":
                string = string.replace(char, "I")
    return string

def correct(string):
#     return string.replace("0", "O").replace("1", "I").replace("5", "S")
    trans = string.maketrans({"0":"O", "1":"I", "5":"S"})
    return string.translate(trans)

def correct(string):
    string=list(string)
    for i in range(len(string)):
        if (isinstance(string[i],int))==True:
            pass
        else:
            if (string[i])=='0':
                string[i]='O'
            if (string[i])=='5':
                string[i]='S'
            if (string[i])=='1':
                string[i]='I'
    string=''.join(string)
    return string


def correct(string):
    inpstr = string
    oplst = []
    for c in inpstr:
        if c.isnumeric():
            if int(c) == 0:
                oplst.append('O')
            elif int(c) == 5:
                oplst.append('S')
            elif int(c) == 1:
                oplst.append('I')
        else:
            oplst.append(c)
    
    return ''.join(oplst)

def correct(string):
    output=""
    for i in range(len(string)):
        if string[i]=="5":
            output=output+"S"
        elif string[i]=="0":
            output=output+"O"
        elif string[i]=="1":
            output=output+"I"
        else:
            output=output+string[i]
    return output

def correct(string):
    answer = ""
    for i in string:
        if i == "0":
            answer += "O"
        elif i == "5":
            answer += "S"
        elif i == "1":
            answer += "I"
        else:
            answer += i
    return answer

def correct(string):
    var1 = string.replace("0", "O")
    var2 = var1.replace("5", "S")
    var3 = var2.replace("1", "I")
    return var3

def correct(string):
    string2 = ''
    for char in string:
        if char == '0':
            string2 = string2 + 'O'
        elif char == '1':
            string2 = string2 + 'I'
        elif char == '5':
            string2 = string2 + 'S'
        else:
            string2 = string2 + char
    return string2
        


def correct(string):
    for i in string:
        if i == "0":
            string = string.replace("0", "O")
            print(string)
        elif i == "1":
            string = string.replace("1", "I")
        elif i == "5":
            string = string.replace("5", "S")
    return string


def correct(string):
    
    li = []



    for i in string:
        li.append(i)
    print(li)

    for i in range(len(li)):
        if li[i] == '0':
            li[i] = 'O'
        elif li[i] == '1':
            li[i] = 'I'
        elif li[i] == '5':
            li[i] = 'S'


    return "".join(li)
            


def correct(string):
    letters = [i for i in string]
    for i in letters:
        if i == "5":
            letters[letters.index(i)] = "S"
        elif i == "0":
            letters[letters.index(i)] = "O"
        elif i == "1":
            letters[letters.index(i)] = "I"
    return "".join(letters)

def correct(string):
    string = string.replace('1', 'I')
    string = string.replace('0', 'O')
    return string.replace('5', 'S')

def correct(string):
    d = []
    for i in string:
        if i == "5":
            d.append("S")
        elif i == "0":
            d.append("O")  
        elif i == "1":
            d.append("I")  
        else:
            d.append(i)
    return "".join(d)      

def correct(string):
    dict = {"5":"S", "0":"O", "1":"I"}
    new = ""
    for i in string:
        if i in dict.keys():
            new += dict[i]
        else:
            new += i
    return new

def correct(string):
    wrong = ['5','0','1']
    right = ['S','O','I']
    for x in wrong:
        string = string.replace(x,right[wrong.index(x)])
    return string

def correct(string):
    return "".join("I" if k == "1" else k for k in ("O" if j == "0" else j for j in ("S" if i == "5" else i for i in string)))


def correct(string):
    
    ans1 = string.replace("5","S")
    ans2 = ans1.replace("0","O")
    ans3 = ans2.replace("1","I")
  
    return ans3

def correct(string):
    
    answer1 = string.replace("5","S")
    
    
    answer2 = answer1.replace("0","O")
    
    answer3 = answer2.replace("1","I")

    return answer3

def correct(string):
    newstring = ""
    for item in string:
        if item in ['5','0','1']:
            if item == "5":
                newstring = newstring + "S"
            if item == "0":
                newstring = newstring + "O"
            if item == "1":
                newstring = newstring + "I"
        else:
            newstring = newstring + item
    
    return newstring


def correct(string):
    new = ''
    for i in string:
        if i == "0":
            new = new + 'O'
        elif i == '1':
            new = new + 'I'
        elif i == '5':
            new = new + 'S'
        else:
            new = new + i
    return new


import re
def correct(string):
    string = re.sub('0', 'O', string)
    string = re.sub('5', 'S', string)
    string = re.sub('1', 'I', string)
    
    return string
    


def correct(string):
    answer = ''
    for c in string:
        if c == '5':
            answer += 'S'
        elif c == '0':
            answer += 'O'
        elif c == '1':
            answer += 'I'
        else:
            answer += c
            
    return answer

def correct(string):
    errors = {'5' : 'S',
              '0' : 'O',
              '1' : 'I'}
    n_str = ""
    for letter in string:
        if letter in errors:
            letter = errors[letter]
        n_str = n_str + letter   
    return n_str

def correct(string):
    ans = []
    for i in string:
        if i == '5':
            c = i.replace('5','S')
            ans.append(c)
        elif i == "0":
            c = i.replace('0','O')
            ans.append(c)
        elif i == "1":
            c = i.replace('1','I')
            ans.append(c)
        else:
            ans.append(i)
    return ''.join(ans)

def correct(string):
#    pass
    string=string.replace("5","S")
    string=string.replace("0","O")
    string=string.replace("1","I")
    return string

def correct(string):
    y=((string.replace("5","S")).replace("0","O")).replace("1","I")
#     y=string.replace("0","O")
#     y=string.replace("1","I")
    return y


def correct(string):
    a =[("0","O"),("5","S"),("1","I")]
    for x,y in a:
        
        string = string.replace(x,y)
    return string

def correct(string):
    errors = (("5", "S"), ("0", "O"), ("1", "I"))
    
    for error in errors:
        string = string.replace(*error)
        
    return string

def correct(string):
    print(string)
    a =""
    bad = {"0": "O", "1": "I", "5": "S"}
    for i in string:
        #print(i)
        if i in bad:
            a = a + bad.get(i)
        else:
            a = a + i
    return a

def correct(string):
    inttab = '501'
    outtab = 'SOI'
    x = string.maketrans(inttab, outtab)
    return string.translate(x)

def correct(string):
    l = list(string)
    for idx, char in enumerate(l):
        if char == '5':
            l[idx] = 'S'
        if char == '0':
            l[idx] = 'O'
        if char == '1':
            l[idx] = 'I'
    return ''.join(l)

print(correct("5INGAPORE"))

dict = {"5":"S", "0":"O", "1":"I"}
def correct(string):
    for i in string:
        if i in dict.keys():
            string = string.replace(i, dict[i])
    return string

def correct(string):
    d = {"5":"S","1":"I","0":"O"}
    new = ""
    for i in string:
        if i.isalpha():
            new+=i
        elif i=="5" or i=="0" or i=="1":
            new+= d[i]
        else:
            new+=i
    return new

def correct(string):
    r = ""
    for c in string:
        if c == '0':
            r += 'O'
        elif c == '1':
            r += 'I'
        elif c == '5':
            r += 'S'
        else:
            r += c
    return r

def correct(string):
    neu = string.replace("1", "I").replace("0", "O").replace("5", "S")
    return neu

def correct(string):
    d ={'5':'S', '0':'O', '1':'I'}
    return ''.join([d.get(i,i) for i in string])

def correct(string: str) -> str:
    return string.translate(str.maketrans("501", "SOI"))


def correct(string):
    chars = ['5','0', '1']
    for ch in chars:
        return string.replace(chars[0],"S").replace(chars[1],"O").replace(chars[2], "I")

           
   


def correct(s):
    return s.translate({48:'O',49:'I',53:'S'})

def correct(string):
    letters = {
        '5': 'S',
        '0': 'O',
        '1': 'I'
    }
    
    return ''.join(letters[x] if x.isdigit() else x for x in string)

def correct(string):
    return "".join({"5": "S", "0": "O", "1": "I"}.get(l, l) for l in string)

def correct(string):
    new_string = string.replace('0', 'O')
    newer_string = new_string.replace('1', 'I')
    newest_string = newer_string.replace('5', 'S')
    
    return newest_string
        


def correct(string):
    crtd = []
    for x in string:
        if x == "5":
            x = "S"
        elif x == "0":
            x = "O"
        elif x == "1":
            x = "I"
        crtd.append(x)
    return ''.join(crtd)

def correct(string):
    new_s = ''
    for i in string:
        if not i.isdigit():
            new_s += i
        elif i == '0':
            new_s += 'O'
        elif i == '5':
            new_s += 'S'
        else:
            new_s += 'I'
    return new_s

def correct(string):
    dic1={'5':'S','0':'O','1':'I'}
    return ''.join(dic1.get(char,char) for char in string)

def correct(string):
    return string.translate({53: 'S', 48: 'O', 49: 'I'})

def correct(string):
    x = {'5' : 'S', '0' : 'O', '1' : 'I'}
    return "".join(s if s not in x.keys() else x.get(s) for s in string )

def correct(string: str) -> str:
    """It corrects the errors in the digitised text."""
    return string.replace("5", "S").replace("0", "O").replace("1", "I")

def correct(string):
    for element in string:
        string =  string.replace("1", "I")
        string =  string.replace("5", "S")
        string =  string.replace("0", "O")
    return string

def correct(string):
    return ''.join([{'5':'S','0':'O','1':'I'}.get(i, i) for i in string])


def correct(string):
    if '5' or '0' or '1' in string:      
        string = string.replace('0','O')
        string = string.replace('1','I')
        string = string.replace('5','S')
    return string

def correct(string):
    c=''
    for char in string:
        if char == '0':
            c+='O'
        elif char == '1':
            c+='I'
        elif char == '5':
            c+='S'
        else:
            c+=char
    return c

def correct(string):
    return "".join(["OSI"["051".index(c)] if c in "051" else c for c in string ])

def correct(string):
    new_string = ''
    for letter in string:
        if letter == '5':
            new_string = new_string + 'S'
        elif letter == '1':
            new_string = new_string + 'I'
        elif letter == '0':
            new_string = new_string + 'O'
        else:
            new_string = new_string + letter
    return new_string

import string
def correct(string):
    return string.translate(string.maketrans("051","OSI"))

def correct(string):
    s = ''
    for i in string:
      s = string.replace('5','S').replace('1','I').replace('0','O')
    return s

def correct(string):
    value = {"0":"O","5":"S","1":"I"}
    result = ""
    
    for letter in string :
        if value.get(letter) :
            result = result + value[letter]  
        else :
            result = result + letter
    
    return result

def correct(string):
    x = "501"
    y = "SOI"
    other = string.maketrans(x,y)
    return(string.translate(other))

def correct(string):
    dict = {"5" : "S", "0" : "O", "1" : "I" }
    str = ""
    for x in string:
        if x in dict:
            str += dict[x]
        else:
            str += x
    return(str)


def correct(string):
    dic = {'5':'S', "1": "I", "0": "O"}
    return "".join([dic[x] if x in dic else x for x in list(string) ])


def correct(s):
    x = s.maketrans('501','SOI')
    return s.translate(x)

def correct(string):
    temp = string.replace('5','S')
    temp = temp.replace('0',"O")
    temp = temp.replace('1','I')
    return temp
    pass

def correct(string):
    correct={'5':'S','0':'O','1':'I'}
    for i in correct:
        string=string.replace(i,correct[i])
    return string

def correct(string):
    correct = ''
    for i in string:
        if i == '5':
            correct += 'S'
        elif i == '0':
            correct += 'O'
        elif i == '1':
            correct +='I'
        else:
            correct += i
            
    return correct

def correct(s):
    st=""
    for c in s:
        if c=='5':
            st+='S'
        elif c=='0':
            st+='O'
        elif c=='1':
            st+='I'
        else:
            st+=c
    return st



CORRECTIONS = {
    '0': 'O',
    '5': 'S',
    '1': 'I',
}

CORRECTION_TRANSLATION = str.maketrans(CORRECTIONS)

def correct(string):
    return string.translate(CORRECTION_TRANSLATION)

def correct(string):
    end =''
    for x in string:
        if x =='0':
            end+='O'
        elif x=='5':
            end +='S'
        elif x=='1':
            end += 'I'
        else:
            end +=x
    return end

def correct(string):
#    for i in string:
 #       if i == "5":
#            string = string.replace("5","S")
 #       if i == "0":
  #          string = string.replace("0","O")
  #      if i == "1":
 #           string = string.replace("1","I")
    #return string



    new_word = []
    for letter in string:
        if letter == "5":
            new_word.append("S")
        elif letter == "0":
            new_word.append("O")
        elif letter == "1":
            new_word.append("I")
        else:
            new_word.append(letter)
    return "".join(new_word)


def correct(string):
    str1 = string.replace("0", "O")
    str2 = str1.replace("5", "S")
    str3 = str2.replace("1", "I")
    return str3    
    
            
        
            


def correct(string):
    arr=[]
    for i in string:
        arr.append(i)
    res=""
    for i in range(0,len(arr)):
        if arr[i]=="0":
            arr[i]="O"
        if arr[i]=="5":
            arr[i]="S"
        if arr[i]=="1":
            arr[i]="I"
        res+=arr[i]
    return res