def subst_string(s,j,ch):
    """ substitutes string 'ch' for jth element in string  """
    res = ''
    ls = list(s)
    for i in range(len(s)):
        if i == j:
            res = res + ch
        else:
            res = res + ls[i]
    return res