input = "data\ninitthe problem\nnationthe airline\nradicthe groups\nprofessionthe experience\nthe cat in the hat"
output = re.sub(r'(?<=[a-z])the', 'al', input)
print(output)
data
inital problem
national airline
radical groups
professional experience
the cat in the hat