def replace_at(string,old,new,indices):
    """Replace the substring "old" by "new" in a string at specific locations
    only.
    indices: starting indices of the occurences of "old" where to perform the
    replacement
    return value: string with replacements done"""
    if len(indices) == 0: return string
    indices = sorted(indices)
    s = string[0:indices[0]]
    for i in range(0,len(indices)-1):
        s += string[indices[i]:indices[i+1]].replace(old,new,1)
    s += string[indices[-1]:].replace(old,new,1)
    return s