CodeEff/ECCO huggingface dataset:
# Original solution
import heapq


def dijkstra(adj, start):
    # adj: [[to, cost] * vertices], 0th index must be empty
    dist = [float('inf')] * len(adj)
    dist[start] = 0
    q = []
    heapq.heappush(q, [0, start])
    while q:
        min_dist, v_from = heapq.heappop(q)
        if min_dist > dist[v_from]:
            continue
        v_tos = adj[v_from]
        for v_to in v_tos:
            if min_dist + v_to[1] < dist[v_to[0]]:
                dist[v_to[0]] = min_dist + v_to[1]
                heapq.heappush(q, [dist[v_to[0]], v_to[0]])
    return dist


n, m, start, goal = list(map(int, input().split()))
adj_yen = [[] for _ in range(n+1)]
adj_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = list(map(int, input().split()))
    adj_yen[u].append([v, a])
    adj_yen[v].append([u, a])
    adj_snuuk[u].append([v, b])
    adj_snuuk[v].append([u, b])

min_dist_yen = dijkstra(adj_yen, start)
min_dist_snuuk = dijkstra(adj_snuuk, goal)
lose = [float('inf')] * n
for i in range(1, n+1):
    lose[-i] = min(lose[-i+1], min_dist_yen[n-i+1] + min_dist_snuuk[n-i+1])

for i in range(n):
    print((10 ** 15 - lose[i]))


# Optimized solution
import heapq
import sys
input = sys.stdin.readline


def dijkstra(adj, start):
    # adj: [[to, cost] * vertices], 0th index must be empty
    dist = [float('inf')] * len(adj)
    dist[start] = 0
    q = []
    heapq.heappush(q, [0, start])
    while q:
        min_dist, v_from = heapq.heappop(q)
        if min_dist > dist[v_from]:
            continue
        v_tos = adj[v_from]
        for v_to in v_tos:
            if min_dist + v_to[1] < dist[v_to[0]]:
                dist[v_to[0]] = min_dist + v_to[1]
                heapq.heappush(q, [dist[v_to[0]], v_to[0]])
    return dist


n, m, start, goal = list(map(int, input().split()))
adj_yen = [[] for _ in range(n+1)]
adj_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = list(map(int, input().split()))
    adj_yen[u].append([v, a])
    adj_yen[v].append([u, a])
    adj_snuuk[u].append([v, b])
    adj_snuuk[v].append([u, b])

min_dist_yen = dijkstra(adj_yen, start)
min_dist_snuuk = dijkstra(adj_snuuk, goal)
lose = [float('inf')] * n
for i in range(1, n+1):
    lose[-i] = min(lose[-i+1], min_dist_yen[n-i+1] + min_dist_snuuk[n-i+1])

for i in range(n):
    print((10 ** 15 - lose[i]))
# Original solution
n,m,s,t = map(int,input().split())
uvab = [list(map(int,input().split())) for i in range(m)]
gyen = [[] for i in range(n+1)]
gsnu = [[] for i in range(n+1)]
for u,v,a,b in uvab:
  gyen[u].append((v,a))
  gyen[v].append((u,a))
  gsnu[u].append((v,b))
  gsnu[v].append((u,b))
import heapq as hq
def dijkstra(start,graph):
  dist = [10**18]*(n+1)
  dist[start] = 0
  q = [(0,start)]
  hq.heapify(q)
  while q:
    _,x = hq.heappop(q)
    for y,dd in graph[x]:
      if dist[y] > dist[x]+dd:
        dist[y] = dist[x]+dd
        hq.heappush(q,(dist[y],y))
  return dist
distyen = dijkstra(s,gyen)
distsnu = dijkstra(t,gsnu)
ans = []
for i in range(n,0,-1):
  x = 10**15-(distyen[i]+distsnu[i])
  if i == n:
    ans.append(x)
  else:
    ans.append(max(ans[-1],x))
ans = ans[::-1]
print(*ans,sep="\n")


# Optimized solution
import sys
input = sys.stdin.readline
n,m,s,t = map(int,input().split())
uvab = [list(map(int,input().split())) for i in range(m)]
gyen = [[] for i in range(n+1)]
gsnu = [[] for i in range(n+1)]
for u,v,a,b in uvab:
  gyen[u].append((v,a))
  gyen[v].append((u,a))
  gsnu[u].append((v,b))
  gsnu[v].append((u,b))
import heapq as hq
def dijkstra(start,graph):
  dist = [10**18]*(n+1)
  dist[start] = 0
  q = [(0,start)]
  hq.heapify(q)
  while q:
    _,x = hq.heappop(q)
    for y,dd in graph[x]:
      if dist[y] > dist[x]+dd:
        dist[y] = dist[x]+dd
        hq.heappush(q,(dist[y],y))
  return dist
distyen = dijkstra(s,gyen)
distsnu = dijkstra(t,gsnu)
ans = []
for i in range(n,0,-1):
  x = 10**15-(distyen[i]+distsnu[i])
  if i == n:
    ans.append(x)
  else:
    ans.append(max(ans[-1],x))
ans = ans[::-1]
print(*ans,sep="\n")
# Original solution
from heapq import heappush, heappop

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
graph = [[[] for i in range(N)] for _ in range(2)]
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  graph[0][u].append((v, a)); graph[0][v].append((u, a))
  graph[1][u].append((v, b)); graph[1][v].append((u, b))


def dijkstra(s, mode):
  dist = [-1] * N
  dist[s] = 0
  e = []
  for child, cost in graph[mode][s]:
    heappush(e, (cost, child))
  while e:
    cost, node = heappop(e)
    if dist[node] >= 0:
      continue
    dist[node] = cost
    for child, c in graph[mode][node]:
      if dist[child] >= 0:
        continue
      heappush(e, (cost+c, child))
  return dist
  
dist = [dijkstra(s, 0), dijkstra(t, 1)]  
value = [dist[0][i]+dist[1][i] for i in range(N)]

ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')


# Optimized solution
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
graph = [[[] for i in range(N)] for _ in range(2)]
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  graph[0][u].append((v, a)); graph[0][v].append((u, a))
  graph[1][u].append((v, b)); graph[1][v].append((u, b))


def dijkstra(s, mode):
  dist = [-1] * N
  dist[s] = 0
  e = []
  for child, cost in graph[mode][s]:
    heappush(e, (cost, child))
  while e:
    cost, node = heappop(e)
    if dist[node] >= 0:
      continue
    dist[node] = cost
    for child, c in graph[mode][node]:
      if dist[child] >= 0:
        continue
      heappush(e, (cost+c, child))
  return dist
  
dist = [dijkstra(s, 0), dijkstra(t, 1)]  
value = [dist[0][i]+dist[1][i] for i in range(N)]

ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')
# Original solution
def main():
    import sys
    input = sys.stdin.readline
    import heapq

    n,m,s,t = list(map(int,input().split()))
    edgesYen = [[]for _ in range(n+1)]
    edgesSnuuk = [[]for _ in range(n+1)]
    for _ in range(m):
        u,v,a,b = list(map(int,input().split()))
        edgesYen[u].append((v,a))
        edgesSnuuk[u].append((v,b))
        edgesYen[v].append((u,a))
        edgesSnuuk[v].append((u,b))
    
    def dijkstra(edges,costDic,startPoint):
        que=[(0,startPoint)]
        heapq.heapify(que)
        while que:
            cost,now = heapq.heappop(que)
            if now not in costDic:
                costDic[now] = cost
                for nx,c in edges[now]:
                    if nx not in costDic:
                        heapq.heappush(que,(cost+c,nx))
    costDicYen = {}
    costDicSnuuk = {}
    dijkstra(edgesYen,costDicYen,s)
    dijkstra(edgesSnuuk,costDicSnuuk,t)

    costList = []
    for i in range(1,n+1):
        cost = costDicYen[i]+costDicSnuuk[i]
        costList.append((cost,i))
    heapq.heapify(costList)
    c,l = heapq.heappop(costList)
    for i in range(n):
        while l<=i:
            c,l = heapq.heappop(costList)
        print((10**15-c))
main()

# Optimized solution
"""
前処理として、各地点で両替した場合に最終的に残るスヌークを計算しておく。
これは、s地点から各地点までの円での最小コストと t地点から各地点までのスヌークでの最小コストを計算することで可能である。
次に、各地点で両替した場合に残るスヌークを昇順で保持しておく。
これで前処理は完了。

あとは、小さい順に残スヌークを取り出し、その両替地点の番号がi以下であれば、新しい最小値を取り出し、そうでなければ、その値を出力する。
"""
def main():
    import sys
    input = sys.stdin.readline
    import heapq
    n,m,s,t = list(map(int,input().split()))
    def dijkstra(edges,costDic,startPoint):
        que=[(0,startPoint)]
        heapq.heapify(que)
        while que:
            cost,now = heapq.heappop(que)
            if now not in costDic:
                costDic[now] = cost
                for nx,c in edges[now]:
                    if nx not in costDic:
                        heapq.heappush(que,(cost+c,nx))

    yenEdges = [[] for _ in range(n+1)]
    snuukEdges = [[] for _ in range(n+1)]
    for _ in range(m):
        u,v,a,b = list(map(int,input().split()))
        yenEdges[u].append((v,a))
        yenEdges[v].append((u,a))
        snuukEdges[u].append((v,b))
        snuukEdges[v].append((u,b))
    yenDic = {}
    snuukDic = {}

    dijkstra(yenEdges,yenDic,s)
    dijkstra(snuukEdges,snuukDic,t)

    remainingSnuuk = []
    for i in range(1,n+1):
        remainingSnuuk.append((10**15-(yenDic[i]+snuukDic[i]),i))
    remainingSnuuk.sort(key=lambda x: x[0], reverse=True)

    j = 0
    for i in range(n):
        while remainingSnuuk[j][1] <= i:
            j += 1
        print((remainingSnuuk[j][0]))
main()
# Original solution
from heapq import heappop,heappush
def dijkstra(s,n,edge):
  """
  始点sから各頂点への最短距離を返す

  Parameters
  ----------
  s : int
      視点とする頂点（0-indexed）
  n : int
      グラフの要素数
  eage:list
      グラグ

  Returns
  -------
  dist ：list
  始点sから各頂点への最短距離
  """
  dist=[float("inf")]*n
  dist[s]=0
  used=[-1]*n
  hq=[[dist[s],s]]
  while hq:
    d,cur=heappop(hq)
    if dist[cur]<d:continue # 距離が最小でない場合は飛ばす
    for nx,nxd in edge[cur]:
      if dist[cur]+nxd<dist[nx]:
        dist[nx]=dist[cur]+nxd
        used[nx]=cur
        heappush(hq,[dist[cur]+nxd,nx])
  return dist

n,m,s,t=list(map(int,input().split()))
Gs=[[] for i in range(n)]
Gt=[[] for i in range(n)]
for i in range(m):
  u,v,a,b=list(map(int,input().split()))
  Gs[u-1].append([v-1,a])
  Gs[v-1].append([u-1,a])
  Gt[u-1].append([v-1,b])
  Gt[v-1].append([u-1,b])
s-=1
t-=1
yen=dijkstra(s,n,Gs)
snk=dijkstra(t,n,Gt)
cost=[10**15-(yen[i]+snk[i]) for i in range(n)]
for i in range(n-2,-1,-1):
  cost[i]=max(cost[i],cost[i+1])
for c in cost:
  print(c)



# Optimized solution
import sys
input=sys.stdin.readline
from heapq import heappop,heappush
def dijkstra(s,n,edge):
  """
  始点sから各頂点への最短距離を返す

  Parameters
  ----------
  s : int
      視点とする頂点（0-indexed）
  n : int
      グラフの要素数
  eage:list
      グラグ

  Returns
  -------
  dist ：list
  始点sから各頂点への最短距離
  """
  dist=[float("inf")]*n
  dist[s]=0
  used=[-1]*n
  hq=[[dist[s],s]]
  while hq:
    d,cur=heappop(hq)
    if dist[cur]<d:continue # 距離が最小でない場合は飛ばす
    for nx,nxd in edge[cur]:
      if dist[cur]+nxd<dist[nx]:
        dist[nx]=dist[cur]+nxd
        used[nx]=cur
        heappush(hq,[dist[cur]+nxd,nx])
  return dist

n,m,s,t=list(map(int,input().split()))
Gs=[[] for i in range(n)]
Gt=[[] for i in range(n)]
for i in range(m):
  u,v,a,b=list(map(int,input().split()))
  Gs[u-1].append([v-1,a])
  Gs[v-1].append([u-1,a])
  Gt[u-1].append([v-1,b])
  Gt[v-1].append([u-1,b])
s-=1
t-=1
yen=dijkstra(s,n,Gs)
snk=dijkstra(t,n,Gt)
cost=[10**15-(yen[i]+snk[i]) for i in range(n)]
for i in range(n-2,-1,-1):
  cost[i]=max(cost[i],cost[i+1])
for c in cost:
  print(c)
# Original solution
from heapq import heappush, heappop
inf = float('inf')
mod = 10**9 + 7

class dijkstra:
    def __init__(self, to, start):
        self.N = len(to)
        self.to = [s[:] for s in to]
        self.start = start
        self.dist = [inf] * self.N
        self.dist[start] = 0
        self.cnt = [0] * self.N
        self.cnt[start] = 1
        self.pq = [(self.dist[start], start)]

    def update(self) -> None:
        while self.pq:
            _, v = heappop(self.pq)
            for nv, w in self.to[v]:
                if self.dist[nv] > self.dist[v] + w:
                    self.dist[nv] = self.dist[v] + w
                    heappush(self.pq, (self.dist[nv], nv))
                if self.dist[nv] == self.dist[v] + w:
                    self.cnt[nv] += self.cnt[v]
                    self.cnt[nv] %= mod

n, m, s, t = list(map(int,input().split()))
s -= 1; t -= 1
jpy = [[] for _ in range(n)]
snuke = [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = list(map(int,input().split()))
    u -= 1; v -= 1
    jpy[u].append((v, a))
    jpy[v].append((u, a))
    snuke[u].append((v, b))
    snuke[v].append((u, b))

JPY = dijkstra(jpy, s)
JPY.update()
SNUKE = dijkstra(snuke, t)
SNUKE.update()

cost_list = []
cost = inf

for i in range(n)[::-1]:
    cost = min(cost, JPY.dist[i] + SNUKE.dist[i])
    cost_list.append(cost)

cost_list.reverse()
for cost in cost_list:
    ans = pow(10, 15) - cost
    print(ans)

# Optimized solution
from heapq import heappush, heappop
inf = float('inf')
# mod = 10**9 + 7

class dijkstra:
    def __init__(self, to, start):
        self.N = len(to)
        self.to = [s[:] for s in to]
        self.start = start
        self.dist = [inf] * self.N
        self.dist[start] = 0
        # self.cnt = [0] * self.N
        # self.cnt[start] = 1
        self.pq = [(self.dist[start], start)]

    def update(self) -> None:
        while self.pq:
            _, v = heappop(self.pq)
            for nv, w in self.to[v]:
                if self.dist[nv] > self.dist[v] + w:
                    self.dist[nv] = self.dist[v] + w
                    heappush(self.pq, (self.dist[nv], nv))
                # if self.dist[nv] == self.dist[v] + w:
                #     self.cnt[nv] += self.cnt[v]
                #     self.cnt[nv] %= mod

n, m, s, t = list(map(int,input().split()))
s -= 1; t -= 1
jpy = [[] for _ in range(n)]
snuke = [[] for _ in range(n)]
for _ in range(m):
    u, v, a, b = list(map(int,input().split()))
    u -= 1; v -= 1
    jpy[u].append((v, a))
    jpy[v].append((u, a))
    snuke[u].append((v, b))
    snuke[v].append((u, b))

JPY = dijkstra(jpy, s)
JPY.update()
SNUKE = dijkstra(snuke, t)
SNUKE.update()

cost_list = []
cost = inf

for i in range(n)[::-1]:
    cost = min(cost, JPY.dist[i] + SNUKE.dist[i])
    cost_list.append(cost)

cost_list.reverse()
for cost in cost_list:
    ans = pow(10, 15) - cost
    print(ans)
# Original solution
INF = 10 ** 20
def main():
  d, n = list(map(int,input().split()))
  temp = [int(eval(input())) for i in range(d)]
  temp.insert(0,0)
  alst = []
  blst = []
  clst = []
  for i in range(n):
    a,b,c = list(map(int,input().split()))
    alst.append(a)
    blst.append(b)
    clst.append(c)
  
  dp = [[0] * n for i in range(d + 1)]
  
  t1 = temp[1]
  for i in range(n):
    if not (alst[i] <= t1 <= blst[i]):
      dp[1][i] = -INF
  
  for i in range(2, d + 1):
    t = temp[i]
    predp = dp[i - 1]
    for j in range(n):
      cj = clst[j]
      if alst[j] <= t <= blst[j]:
        dp[i][j] = max(predp[x] + (cj - clst[x] if cj >= clst[x] else clst[x] - cj) for x in range(n))
  
  print((max(dp[d])))

main()


# Optimized solution
INF = 10 ** 20

def main():
  d, n = list(map(int,input().split()))
  temp = [int(eval(input())) for i in range(d)]
  temp.insert(0,0)
  
  alst = []
  blst = []
  clst = []
  
  for i in range(n):
    a,b,c = list(map(int,input().split()))
    alst.append(a)
    blst.append(b)
    clst.append(c)
  
  dp = [[0] * n for i in range(d + 1)]
  
  t1 = temp[1]
  for i in range(n):
    if not (alst[i] <= t1 <= blst[i]):
      dp[1][i] = -INF
  
  for i in range(2, d + 1):
    t = temp[i]
    predp = dp[i - 1]

    for j in range(n):
      cj = clst[j]
      if alst[j] <= t <= blst[j]:
        save = 0
        for x in range(n):
          cx = clst[x]
          if cj >= cx:
            v = predp[x] + cj - cx
          else:
            v = predp[x] - cj + cx
          if save < v:
            save = v
        dp[i][j] = save

  print((max(dp[d])))

main()
# Original solution
import sys
from pprint import pprint

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

len_s = len(s)
len_t = len(t)
# print(len_s, len_t)

cand = []
for i in range(0, len_s - len_t + 1):
    a = list(s)
    flag = True
    for j in range(len_t):
        # print(s[i+j], t[j])
        if s[i+j] == "?":
            a[i+j] = t[j]
        elif s[i+j] != t[j]:
            flag = False
            break
    if flag:
        cand.append(a)

if cand:
    print(("".join(cand[-1]).replace("?", "a")))
    sys.exit()
else:
    print("UNRESTORABLE")

# Optimized solution
import sys

S = list(sys.stdin.readline().rstrip())
T = list(sys.stdin.readline().rstrip())

len_s = len(S)
len_t = len(T)

for i in range(len_s - len_t, -1, -1):
    for j in range(len_t):
        if S[i+j] == T[j] or S[i+j] == "?":
            continue
        else:
            break
    else:
        for k in range(len_t):
            S[i+k] = T[k]

        print((("".join(S)).replace("?","a")))
        exit()

print("UNRESTORABLE")
# Original solution
S = input()[::-1]
T = input()[::-1]

flag = False
for i in range(len(S) - len(T) + 1):
    matched = True

    for j in range(len(T)):

        if S[i + j] != "?" and S[i + j] != T[j]:
            matched = False
    
    if matched:
        S = S[:i] + T + S[i + len(T):]
        flag = True
        break

if flag:
    print((S.replace("?", "a")[::-1]))
else:
    print("UNRESTORABLE")

# Optimized solution
S = input()[::-1]
T = input()[::-1]

flag = False
for i in range(len(S) - len(T) + 1):
    matched = True

    for j in range(len(T)):

        if S[i + j] != "?" and S[i + j] != T[j]:
            matched = False
            break
    
    if matched:
        S = S[:i] + T + S[i + len(T):]
        flag = True
        break

if flag:
    print((S.replace("?", "a")[::-1]))
else:
    print("UNRESTORABLE")
# Original solution
def resolve():
    '''
    code here
    '''
    S_dash = input()
    T = input()

    is_flag = False

    res = ''
    res_list = ['zzzzz']
    for i in range(len(S_dash) - len(T) +1):
        res = S_dash[:i]
        # print(i, res)
        if len(S_dash) - len(res) >= len(T):
            for j in range(len(T)):
                if S_dash[i+j] == T[j] or S_dash[i+j] == '?':
                    res += T[j]
                else:
                    # print('bk')
                    break
            else:
                is_flag = True
                res += S_dash[i+len(T):]
                res_list.append(res)


    # print(res_list)

    res2_list = []
    for res in res_list:
        res = res.replace('?','a')
        res2_list.append(res)

    res2_list.sort()
    res = res2_list[0]

    print(res) if is_flag else print('UNRESTORABLE')     

if __name__ == "__main__":
    resolve()


# Optimized solution
def resolve():
    '''
    code here
    '''
    S_dash = input()[::-1]
    T = input()[::-1]

    is_flag = False

    res = ''

    for i in range(len(S_dash)):
        res = S_dash[:i]
        # print(res)
        if len(S_dash) - len(res) >= len(T):
            for j in range(len(T)):
                if S_dash[i+j] == T[j] or S_dash[i+j] == '?':
                    res += T[j]
                else:
                    # print('bk')
                    break
            else:
                is_flag = True
                break

        # print(res)

    # print(S_dash, T, res)
    # print(S_dash[len(T):])
    res = res + S_dash[len(T)+i:]
    res = res.replace('?','a')

    print(res[::-1]) if is_flag else print('UNRESTORABLE')     

if __name__ == "__main__":
    resolve()
# Original solution
S = input().strip()
T = input().strip()
N = len(S)
K = len(T)
A = list(S)
for i in range(N-K,-1,-1):
    a = S[i:i+K]
    flag = 0
    for j in range(K):
        if a[j]!="?" and a[j]!=T[j]:
            flag = 1
            break
    if flag==1:continue
    A[i:i+K] = T[:]
    for j in range(N):
        if A[j]=="?":
            A[j]="a"
    break
if "?" in A:
    print("UNRESTORABLE")
else:
    print(("".join(A)))

# Optimized solution
S1 = list(input().strip())
T = list(input().strip())
n = len(S1)
k = len(T)
G = []
for i in range(n-k+1):
    flag = 0
    for j in range(i,i+k):
        if S1[j]!="?" and S1[j]!=T[j-i]:
            flag = 1
            break
    if flag==0:
        A = S1[:]
        A[i:i+k] = T[:]
        for j in range(n):
            if A[j]=="?":
                A[j] = "a"
        G.append(A)
G = sorted(G)
if len(G)>0:
    print(("".join(G[0])))
else:
    print("UNRESTORABLE")
# Original solution
S1 = list(input().strip())
T = list(input().strip())
n = len(S1)
k = len(T)
G = []
for i in range(n-k+1):
    flag = 0
    for j in range(i,i+k):
        if S1[j]!="?" and S1[j]!=T[j-i]:
            flag = 1
            break
    if flag==0:
        A = S1[:]
        A[i:i+k] = T[:]
        for j in range(n):
            if A[j]=="?":
                A[j] = "a"
        G.append(A)
G = sorted(G)
if len(G)>0:
    print(("".join(G[0])))
else:
    print("UNRESTORABLE")

# Optimized solution
S = input().strip()
N=len(S)
T = input().strip()
M=len(T)
A = []
for i in range(N-M+1):
    flag = 0
    for j in range(i,i+M):
        if S[j]=="?" or S[j]==T[j-i]:continue
        else:
            flag=1
            break
    if flag==0:
        X = list(S)
        for j in range(i,i+M):
            X[j] = T[j-i]
        for i in range(N):
            if X[i]=="?":
                X[i]="a"
        A.append(X)
if len(A)==0:
    print("UNRESTORABLE")
else:
    A = sorted(A)
    print(("".join(A[0])))
# Original solution
S = input().strip()
N=len(S)
T = input().strip()
M=len(T)
A = []
for i in range(N-M+1):
    flag = 0
    for j in range(i,i+M):
        if S[j]=="?" or S[j]==T[j-i]:continue
        else:
            flag=1
            break
    if flag==0:
        X = list(S)
        for j in range(i,i+M):
            X[j] = T[j-i]
        for i in range(N):
            if X[i]=="?":
                X[i]="a"
        A.append(X)
if len(A)==0:
    print("UNRESTORABLE")
else:
    A = sorted(A)
    print(("".join(A[0])))

# Optimized solution
S = input().strip()
N = len(S)
T = input().strip()
K = len(T)
flag = 0
ind = -1
for i in range(N-K,-1,-1):
    A = list(S[i:i+K])
    flag = 0
    for j in range(K):
        if A[j]!="?" and A[j]!=T[j]:
            flag = 1
            break
    if flag == 0:
        ind = i
        break
if ind<0:
    print("UNRESTORABLE")
else:
    S = list(S)
    for j in range(K):
        if S[ind+j]=="?":
            S[ind+j] = T[j]
    for i in range(N):
        if S[i]=="?":
            S[i]="a"
    print(("".join(S)))
# Original solution
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    t = str(readline().rstrip().decode('utf-8'))
    k = len(t)
    for i in range(len(s) - k, -1, -1):
        ts = s[i:i+k]
        b = True
        for j in range(k):
            if ts[j] != "?" and ts[j] != t[j]:
                b = False
                break
        if b:
            a = []
            f = True
            for j in range(len(s)):
                if j < i or i + k <= j:
                    if s[j] == "?":
                        a.append("a")
                    else:
                        a.append(s[j])
                else:
                    if f:
                        a = a + list(t)
                        f = False
            print(("".join(a)))
            exit()
    print("UNRESTORABLE")


if __name__ == '__main__':
    solve()


# Optimized solution
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    t = str(readline().rstrip().decode('utf-8'))
    lt = len(t)
    for i in range(len(s) - lt, -1, -1):
        ts = s[i:i+lt]
        b = True
        for j in range(len(ts)):
            if ts[j] != "?" and ts[j] != t[j]:
                b = False
                break
        if b:
            ans = []
            for j in range(len(s)):
                if i <= j < i + lt:
                    ans.append(t[j-i])
                else:
                    if s[j] == "?":
                        ans.append("a")
                    else:
                        ans.append(s[j])
            print(("".join(ans)))
            exit()
    print("UNRESTORABLE")


if __name__ == '__main__':
    solve()