import re


def replace_halogen(smiles):
    """
    Replace halogens with single letters (Cl -> L and Br -> R), following
    Olivecrona et al. (J Cheminf 2018).
    """
    br = re.compile('Br')
    cl = re.compile('Cl')
    smiles = br.sub('R', smiles)
    smiles = cl.sub('L', smiles)
    return smiles