E869120 found a chest which is likely to contain treasure.

However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.

He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.  
One more thing he found is a sheet of paper with the following facts written on it:  
 - Condition 1: The string S contains a string T as a contiguous substring.
 - Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.
Print the string S.

If such a string does not exist, print UNRESTORABLE.  

-----Constraints-----
 - 1 \leq |S'|, |T| \leq 50
 - S' consists of lowercase English letters and ?.
 - T consists of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
S
T'

-----Output-----
Print the string S.

If such a string does not exist, print UNRESTORABLE instead.  

-----Sample Input-----
?tc????
coder

-----Sample Output-----
atcoder

There are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.
Among them, the lexicographically smallest is atcoder, so we can say S = atcoder.
[{"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 28 02:20:36 2020\n\n@author: liang\n\"\"\"\nS = input()\nT = input()\n\nS = S[::-1]\nT = T[::-1]\n\nres = list()\n\nfor i in range(len(S)-len(T)+1):\n    flag = True\n    for j in range(len(T)):\n        if S[i+j] == \"?\" or S[i+j] == T[j]:\n            continue\n        else:\n            flag = False\n    if flag == True:\n        ans = \"\"\n        for k in range(len(S)):\n            if i <= k <= i + len(T)-1:\n                #print(T[k-i])\n                ans += T[k-i]\n            elif S[k] != \"?\":\n                #print(\"B\")\n                ans += S[k]\n            else:\n                #print(\"C\")\n                ans += \"a\"\n        ans = ans[::-1]\n        res.append(ans)\n\nif res:\n    res.sort()\n    print((res[0]))\nelse:\n    print(\"UNRESTORABLE\")\n#print(S)\n#print(T)\n", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "s = input()\nt = input()\n\nls = len(s)\nlt = len(t)\ncheck = False\nans = 'z'*60\nfor i in range(ls-lt+1):\n    u = list(s)\n    flag = True\n    for j in range(lt):\n        if u[i+j] == '?':\n            u[i+j] = t[j]\n        elif u[i+j] != t[j]:\n            flag = False\n            break\n    if flag:\n        check = True\n        u = ''.join(u).replace('?', 'a')\n        ans = sorted([ans, u])[0]\nprint(ans if check else 'UNRESTORABLE')", "passed": true, "time": 0.3, "memory": 14080.0, "status": "done"}, {"code": "S_ = list(input())\nT = input()\n#\u5f8c\u308d\u304b\u3089\u63a2\u7d22\u3059\u308b\n\nn = len(S_)\nm = len(T)\nnonexist = 1\nfor i in range(n-1, m-2, -1):\n    flg = True\n    for j in range(m):\n        if (S_[i-j] != T[-j-1]) and (S_[i-j] != \"?\"):\n            flg = False\n            break\n    if flg:\n        nonexist = 0\n        index = i\n        break\n\nif nonexist:\n    print(\"UNRESTORABLE\")\n    return\n\nindex -= m-1\nfor i in range(m):\n    S_[index+i] = T[i]\n\nfor i in range(n):\n    if S_[i] == \"?\":\n        S_[i] = \"a\"\nprint((\"\".join(S_)))\n", "passed": true, "time": 0.15, "memory": 14108.0, "status": "done"}, {"code": "s = input()\nt = input()\n\nfor i in range(len(s) - len(t) + 1)[::-1]:\n    cnt = 0\n    q = 0\n    for j in range(len(t))[::-1]:\n        if s[i + j] == '?':\n            q += 1\n        elif s[i + j] == t[j]:\n            cnt += 1\n    \n    if cnt == len(t) - q:\n        idx = i\n        s = s[:idx] + t + s[idx + len(t):]\n        for k in range(len(s)):\n            if s[k] == '?':\n                s = s[:k] + 'a' + s[k + 1:]\n        print(s)\n        break\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.23, "memory": 14284.0, "status": "done"}, {"code": "s = input()[::-1]\nt = input()[::-1]\n\ndef match(string,substring):\n    for a,b in zip(string, substring):\n        if a == '?':\n            continue\n        if a != b:\n            return False\n    return True\n\n# \u306a\u308b\u3079\u304f\u5f8c\u65b9\u3067\u4e00\u81f4\u3055\u305b\u308b\nLEN_S = len(s)\nLEN_T = len(t)\nans = ''\nfor i in range(LEN_S - LEN_T + 1):\n    sub = s[i:i+LEN_S]\n    if match(sub, t):\n        ans = s[:i] + t + s[i+LEN_T:]\n        ans = ans[::-1].replace('?', 'a')\n        break\nelse:\n    print('UNRESTORABLE')\n    return\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "s = list(input())\nt = list(input())\nnum = len(t)\n\nfail = 'UNRESTORABLE'\nflag = False\nans = []\ncount_out = 0\n\nfor i in range(len(s)):\n    start = i\n    end = i + len(t)\n    if (end > len(s)):\n        break\n    tar = s[start:end]\n    # print(tar)\n    index = 0\n    name_flag = True\n\n    for a, b in zip(tar, t):\n        # print(tar[index])\n        if (a == b):\n            pass\n        elif (a == '?'):\n            tar[index] = str(b)\n        else:\n            name_flag = False\n            break\n\n        index += 1\n\n    if (name_flag is False):\n        ans.append(['z'] * len(s))\n        count_out += 1\n    else:\n        pre_org = s[:start]\n        # pre = pre_org.replace('?', 'a')\n        post_org = s[end:]\n        # post = post_org.replace('?', 'a')\n\n        # tar_mod = pre + tar + post\n        tar_mod = pre_org + tar + post_org\n        ans.append(tar_mod)\n\n# print(ans)\nif (count_out == (len(s) - len(t) + 1)):\n    print(fail)\nelse:\n    ans_s = sorted(ans)\n    aa = ans_s[0]\n    a2 = ''.join(aa)\n    a3 = a2.replace('?', 'a')\n    print(a3)\n", "passed": true, "time": 0.24, "memory": 14120.0, "status": "done"}, {"code": "s = input()\nt = input()\n\ns_streak = 0\ns_streak_ind = -1\n\n\nfor j in range(len(s)-1, -1, -1):\n\tfor i in range(j, -1, -1):\n\t\tif s_streak_ind == -1:\n\t\t\tif s[i] == \"?\" or s[i] == t[len(t)-1-s_streak]:\n\t\t\t\tif s_streak == len(t) - 1:\n\t\t\t\t\ts_streak_ind = i\n\t\t\t\t\ts_streak = 0\n\t\t\t\telse:\n\t\t\t\t\ts_streak += 1\n\t\t\telse:\n\t\t\t\ts_streak = 0\n\ts_streak = 0\n\n#print(s_streak_ind)\n\nif s_streak_ind == -1:\n\tprint(\"UNRESTORABLE\")\nelse:\n\tansl = []\n\tfor i in range(len(s)):\n\t\tif s[i] == \"?\":\n\t\t\tif s_streak_ind <= i < s_streak_ind+len(t):\n\t\t\t\tansl.append(t[i-s_streak_ind])\n\t\t\telse:\n\t\t\t\tansl.append(\"a\")\n\t\telse:\n\t\t\tansl.append(s[i])\n\tprint(\"\".join(ansl))", "passed": true, "time": 0.26, "memory": 14336.0, "status": "done"}, {"code": "S = list(input())\nT = list(input())\ns = len(S)\nt = len(T)\nfor i in range(s-t,-1,-1):\n    ss = S[i:i+t]\n    for j in range(t):\n        if ss[j] != \"?\" and ss[j] != T[j]:\n            break\n    else:\n        for j in range(t):\n            if ss[j] == \"?\":\n                S[i+j] = T[j]\n        break\nelse:\n    print(\"UNRESTORABLE\")\n    return\nfor i in range(s):\n    if S[i] == \"?\":\n        S[i] = \"a\"\nprint(\"\".join(S))", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "import copy\nS = list(input())\nT = input()\nlS = len(S)\nlT = len(T)\nans = []\nfor s in range(lS-lT+1):\n    temp = copy.copy(S)\n    for t in range(lT):\n        if temp[s+t] != T[t] and temp[s+t] != '?':\n            break\n        else:\n            temp[s+t] = T[t]\n    else:\n        temp = [temp[i] if temp[i] != '?' else 'a' for i in range(lS)]\n        ans.append(''.join(temp))\nans = sorted(ans)\nif len(ans) == 0:\n    print('UNRESTORABLE')\nelse:\n    print(ans[0])", "passed": true, "time": 0.26, "memory": 14208.0, "status": "done"}, {"code": "S_ = input()\nT = input()\nlen_T = len(T)\nlen_S = len(S_)\n\nA = []\nfor i in range(len_S - len_T + 1):\n    flg = True\n    for t, s in zip(T, S_[i:i + len_T]):\n        if s != '?' and s != t:\n            flg = False\n    if flg == True:\n        S = ''\n        for j in range(len_S):\n            if i <= j < i + len_T:\n                S += T[j - i]\n            elif S_[j] == '?':\n                S += 'a'\n            else:\n                S += S_[j]\n        A.append(S)\n\nans = 'z' * (len_S + 1)\nfor S in A:\n    if S < ans:\n        ans = S\nif ans == 'z' * (len_S + 1):\n    print('UNRESTORABLE')\nelse:\n    print(ans)", "passed": true, "time": 0.17, "memory": 14352.0, "status": "done"}, {"code": "S=input()\nT=input()\nL,M=len(S),len(T)\na=-1\nfor i in range(L-M,-1,-1):\n    if sum([1 for j in range(M) if S[i+j]=='?' or S[i+j]==T[j]])==M:\n        a=i\n        break\nprint('UNRESTORABLE' if a<0 else ''.join([T[i-a] if a<=i<a+M else 'a' if S[i]=='?' else S[i] for i in range(L)]))", "passed": true, "time": 0.16, "memory": 14104.0, "status": "done"}, {"code": "import sys\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return list(map(int, stdin.readline().split()))\ndef nl(): return list(map(int, stdin.readline().split()))\n\n\ndef can_replace(S, T):\n    cnt = 0\n    for s, t in zip(S, T):\n        if s == t or s == '?':\n            cnt += 1\n    if cnt == len(S):\n        return True\n    else:\n        return False\n\n\ndef main():\n    S = list(ns()[::-1])\n    T = list(ns()[::-1])\n    for i in range(len(S) - len(T) + 1):\n        if can_replace(S[i:i + len(T)], T):\n            S[i:i + len(T)] = T\n            S = ''.join(S)\n            print((S.replace('?', 'a')[::-1]))\n            return\n    print('UNRESTORABLE')\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.17, "memory": 14272.0, "status": "done"}, {"code": "s = input()\nt = input()\nn, m = len(s), len(t)\n\nfor i in range(n - m, -1, -1):\n    match = True\n    for j in range(m):\n        if s[i + j] != '?' and s[i + j] != t[j]:\n            match = False\n            break\n    if match:\n        print((s[:i].replace('?', 'a') + t + s[i + m:].replace('?', 'a')))\n        return\nprint(\"UNRESTORABLE\")\n", "passed": true, "time": 0.18, "memory": 14120.0, "status": "done"}, {"code": "s = input()\nt = input()\n\ns_length = len(s)\nt_length = len(t)\n\nans = ''\nkeep = ''\nremind = 0\nchecker = False\nfor i in range(s_length):\n    if (i + t_length) <= s_length:\n        check = True\n        for j in range(t_length):\n            if (s[i + j] != t[j]) & (s[i + j] != '?'):\n                check = False\n        if check:\n            checker = True\n            ans = keep + t\n            remind = i + t_length\n    if s[i] == '?':\n        keep += 'a'\n    else:\n        keep += s[i]\nans = ans + keep[remind:]\n\nif checker:\n    print(ans)\nelse:\n    print('UNRESTORABLE')\n", "passed": true, "time": 0.2, "memory": 14152.0, "status": "done"}, {"code": "Sp = str(input())\nT = list(input())\nans = []\nANS = []\nfor i in range(len(Sp)-len(T)+1):\n  S = list(Sp)\n  for j in range(len(T)):\n    if S[i+j] == T[j] or S[i+j] == \"?\":\n      S[i+j] = T[j]\n      if j == len(T)-1:\n        ans.append(S)\n    else:\n      break\nif len(ans) == 0:\n  print('UNRESTORABLE')\nelse:\n  for i in range(len(ans)):\n    for j in range(len(Sp)):\n      if ans[i][j] == \"?\":\n        ans[i][j] = \"a\"\n    ANS.append(\"\".join(ans[i]))\n  ANS.sort()\n  print(ANS[0])", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "import re\n\ns = input().replace('?', '.')\nt = input()\n\nfor i in range(len(s)-len(t), -1, -1):\n    if re.match(s[i:i+len(t):], t):\n        s = s.replace('.', 'a')\n        print(s[:i:]+t+s[i+len(t)::])\n        return\nprint('UNRESTORABLE')", "passed": true, "time": 0.16, "memory": 14404.0, "status": "done"}, {"code": "s=list(input())\nls=len(s)\nt=list(input())\nlt=len(t)\ncan=[]\nfor i in range(ls-lt,-1,-1):\n    ok=0\n    for j in range(lt):\n        if s[i+j]==t[j] or s[i+j]=='?':\n            ok+=1\n    if ok==lt:\n        c=[0]*ls\n        for k in range(ls):\n            if s[k]=='?':\n                if k<i or k>=i+lt:\n                    c[k]='a'\n                else:\n                    c[k]=t[k-i]\n            else:\n                c[k]=s[k]\n        can.append(''.join(c))\nif len(can)==0:\n    print('UNRESTORABLE')\nelse:\n    print(sorted(list(can))[0])", "passed": true, "time": 0.15, "memory": 14332.0, "status": "done"}, {"code": "s,t=input(),input()\nans='z'*len(s)\nfor i in range(len(s)-len(t)+1):\n    pre=s[:i].replace(\"?\",'a')\n    \n    for x,y in zip(list(s[i:]),list(t)):\n        if x!=\"?\"and x!=y:break\n        pre+=y\n    else:\n        pre+=s[i+len(t):].replace(\"?\",'a')\n        ans=min(ans,pre)\nprint(ans if ans!='z'*len(s) else 'UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "s=input()\nT=input()\n\ns=''.join([x if x!='?' else '1' for x in list(s)])\n\nstart=[]\nfor i in range(len(s)-len(T)+1):\n    tmp=0\n    for j in range(len(T)):\n        if s[i+j]==T[j] or s[i+j]=='1': tmp+=1\n    if tmp==len(T): start.append(i)\n\ncandidates=[]\nt=len(T)\nans=''\nif len(start):\n    for st in start:\n        tmp=s[:st]+T+s[st+t:]\n        candidates.append(tmp)\n    candidates.sort()\n    ans=candidates[0].replace('1','a')\nelse:\n    ans='UNRESTORABLE'\n\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14104.0, "status": "done"}, {"code": "S = input()[::-1]\nT = input()[::-1]\n\nflag = False\nfor i in range(len(S) - len(T) + 1):\n    matched = True\n\n    for j in range(len(T)):\n\n        if S[i + j] != \"?\" and S[i + j] != T[j]:\n            matched = False\n    \n    if matched:\n        S = S[:i] + T + S[i + len(T):]\n        flag = True\n        break\n\nif flag:\n    print(S.replace(\"?\", \"a\")[::-1])\nelse:\n    print(\"UNRESTORABLE\")", "passed": true, "time": 0.15, "memory": 14152.0, "status": "done"}, {"code": "s = input()\nn = len(s)\nt = input()\nm = len(t)\nans = []\n\nfor i in range(n-m+1):\n    for j in range(m):\n        if s[i+j] not in [t[j] , \"?\"]:\n            break\n        elif j == m-1:\n            res = s[:i]+t+s[i+m:]\n            ans.append(res.replace(\"?\",\"a\"))\n\nif not ans:\n    ans.append(\"UNRESTORABLE\")\n\nprint(min(ans))", "passed": true, "time": 0.16, "memory": 14020.0, "status": "done"}, {"code": "S = input()[::-1]\nT = input()[::-1]\n\nflag = False\nfor i in range(len(S) - len(T) + 1):\n    matched = True\n\n    for j in range(len(T)):\n        # \u3046\u30fc\u3093...\n        if i == len(S) - len(T) + 1:\n            break\n\n        if S[i + j] != \"?\" and S[i + j] != T[j]:\n            matched = False\n    \n    if matched:\n        S = S[:i] + T + S[i + len(T):]\n        flag = True\n        break\n\nif flag:\n    print(S.replace(\"?\", \"a\")[::-1])\nelse:\n    print(\"UNRESTORABLE\")", "passed": true, "time": 0.16, "memory": 14296.0, "status": "done"}, {"code": "s = input()\nt = input()\nans = list(s)\n\nif len(s)>=len(t):\n    for i in reversed(list(range(len(s)-len(t)+1))):\n        flg=True\n        for j in range(len(t)):\n            if s[i+j]==\"?\":\n                continue\n            if s[i+j]!=t[j]:\n                flg=False\n                break\n        if flg:\n            for j in range(len(t)):\n                ans[i+j]=t[j]\n\n            break\nelse:\n    flg=False\n\nans = \"\".join(ans)\nans = ans.replace(\"?\",\"a\")\n\nprint((ans if flg else \"UNRESTORABLE\"))\n\n", "passed": true, "time": 0.16, "memory": 14104.0, "status": "done"}, {"code": "s = input()\nt = input()\nmatch_index = 51\nfor i in range(len(s) - len(t) + 1):\n    s_tmp = s[i:i + len(t)]\n    for j in range(len(t)):\n        if s_tmp[j] == t[j] or s_tmp[j] == \"?\":\n            pass\n        else:\n            break\n    else:\n        match_index = i\n\nif match_index == 51:\n    print(\"UNRESTORABLE\")\nelse:\n    s_replace = \"\"\n    for i in range(match_index):\n        s_replace += s[i]\n    s_replace += t\n    for i in range(match_index + len(t), len(s)):\n        s_replace += s[i]\n\n    # s[match_index:match_index + len(t)] = t\n    res = \"\"\n    for i in s_replace:\n        if i == \"?\":\n            res += \"a\"\n        else:\n            res += i\n    print(res)\n", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "\ns_o = str(input().strip())\nt_o = str(input().strip())\ndic = []\n\nfor i in range(len(s_o)-len(t_o)+1):\n    s = s_o\n    t = t_o\n    flg = 0\n    for j in range(len(t_o)):\n        if s[i+j] == t[j] or s[i+j] == \"?\":\n            s = s[:i+j] + t[j] + s[i+j+1:]\n        else:\n            flg = 1\n            break\n    if flg:\n        continue\n    s = s.replace(\"?\", \"a\")\n    dic.append(s)\n\nif len(dic) == 0:\n    print(\"UNRESTORABLE\")\nelse:\n    dic.sort()\n    print(dic[0])", "passed": true, "time": 0.15, "memory": 14040.0, "status": "done"}, {"code": "#abc076 C\nfrom copy import deepcopy\ns = list(input())\nt = list(input())\nls = len(s)\nlt = len(t)\n\nrev_s = s[::-1]\nrev_t = t[::-1]\n\nfor x in range(ls-lt+1):\n    if rev_s[x:x+lt] == [\"?\"] * lt:\n        for y in range(lt):\n            rev_s[x+y] = rev_t[y]\n        ns = rev_s[::-1]\n        S = \"\".join(ns)\n        ans = S.replace(\"?\", \"a\")\n        print(ans)\n        return\n\n\nfor i in range(lt):\n    for j in range(i, ls):\n        if rev_t[i] == rev_s[j]:\n            flag = True\n            t_temp = deepcopy(rev_t)\n            s_temp = deepcopy(rev_s)\n            for k in range(-i, lt-i):\n                if j+k >= ls or j+k < 0:\n                    flag = False\n                    break\n                elif t_temp[i+k] == s_temp[j+k]:\n                    pass\n                elif s_temp[j+k] == \"?\":\n                    s_temp[j+k] = t_temp[i+k]\n                elif t_temp[i+k] != s_temp[j+k]:\n                    flag = False\n                    break\n            if flag:\n                ns = s_temp[::-1]\n                S = \"\".join(ns)\n                ans = S.replace(\"?\", \"a\")\n                print(ans)\n                return\n\nprint(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "sd = input()\nt = input()\n\nn = len(sd)\nm = len(t)\ns = []\n\n# sd \u3092\u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\u3001 t \u306e\u5165\u308a\u305d\u3046\u306a\u5834\u6240\u3092\u63a2\u3059\nfor i in range(n - m, -1, -1):\n    t_kamo = sd[i:i + m]\n    for j in range(m + 1):\n        # 1\u6587\u5b57\u305a\u3064\u9806\u306b\u5165\u308a\u3046\u308b\u304b\u8abf\u3079\u3001\u6700\u5f8c\u307e\u3067\u5165\u308b\u306a\u3089 \"?\" \u3092 \"a\" \u306b\u7f6e\u304d\u63db\u3048\u3066\u51fa\u529b\n        if j == m:\n            print((sd[:i] + t + sd[i + len(t):]).replace(\"?\", \"a\"))\n            return\n        if t_kamo[j] == \"?\":\n            continue\n        elif t_kamo[j] != t[j]:\n            break\n\nprint(\"UNRESTORABLE\")", "passed": true, "time": 0.15, "memory": 14240.0, "status": "done"}, {"code": "s = input()\nt = input()\nl = []\nfor i in range(len(s)-len(t)+1):\n    for j in range(i, i+len(t)):\n        if s[j] != \"?\" and s[j] != t[j-i]:\n            break\n    else:\n        l.append(s[:i]+t+s[i+len(t):])\nif len(l) == 0:\n    print(\"UNRESTORABLE\")\n    return\nl.sort()\nprint(l[0].replace(\"?\", \"a\"))", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "s = input()\nt = input()\nn = len(s)\nm = len(t)\nans = []\nfor i in range(n-m+1):\n    c = 0\n    for j in range(m):\n        if s[i+j] == '?' or s[i+j] == t[j]:\n            c += 1\n    if c == m:\n        s_ = s[0:i] + t + s[i+m:]\n        s_ = s_.replace('?', 'a')\n        ans.append(s_)\nif len(ans)>0:\n    print((sorted(ans)[0]))\nelse:\n    print('UNRESTORABLE')\n", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "s=input()\nt=input()\nls=len(s)\nlt=len(t)\n\nans=0\nfor i in range(ls-lt+1):\n  x=s[:i]+t+s[i+lt:ls]\n  f=1\n  for j in range(ls):\n    if s[j]=='?':\n      continue\n    if s[j]!=x[j]:\n      f=0\n      break\n  if f:\n    p=''\n    for k in range(ls):\n      if x[k]=='?':\n        p+='a'\n      else:\n        p+=x[k]\n    ans=p\n    \nif ans:\n  print(p)\nelse:\n  print('UNRESTORABLE')\n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "S0 = input()\nT = input()\n\nn, m = len(S0), len(T)\nif n < m:\n    print(\"UNRESTORABLE\")\n    return\n\nstart, end = -1, -1\nfor i in reversed(range(n - m + 1)):\n    ok = True\n    for j in range(m):\n        ok = ok and (S0[i + j] == T[j] or S0[i + j] == '?')\n    if ok:\n        start = i\n        end = i + m - 1\n        break\n\nif start >= 0:\n    S = ''\n    for i in range(n):\n        if start <= i <= end:\n            S += T[i - start]\n        else:\n            if S0[i] == '?':\n                S += 'a'\n            else:\n                S += S0[i]\n    print(S)\nelse:\n    print(\"UNRESTORABLE\")", "passed": true, "time": 0.21, "memory": 14296.0, "status": "done"}, {"code": "a = input()\nb = input()\n\nlength = len(a) - len(b) + 1\n\nans = []\nfor i in range(length):\n    A = list('?'*i+b+'?'*(length-i-1))\n    flag = True\n    for j in range(len(a)):\n        if a[j] == '?' or a[j] == A[j]:\n            pass\n        elif a[j] != '?' and A[j] == '?':\n            A[j] = a[j]\n        else:\n            flag = False\n    if flag:\n        ans.append(''.join(A).replace('?','a'))\n\nif ans:\n    ans.sort()\n    print(ans[0])\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "Sd = input()\nT = input()\n#Sd\u306e?\u4ee5\u5916\u306e\u6587\u5b57\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u53d6\u5f97\nindexes = []\nfor i in range(len(Sd)):\n    if Sd[i] != \"?\":\n        indexes.append(i)\n\nt0 = 0#t\u306e\u5148\u982d\u4f4d\u7f6e\nS_list = []\nwhile t0 <= (len(Sd)-len(T)):\n    flg = 0\n    tmp_S = Sd[:t0] + T + Sd[t0+len(T):]\n\n    #\u6761\u4ef61\u3092\u6e80\u305f\u3059\u304b\u3069\u3046\u304b\u306e\u30c1\u30a7\u30c3\u30af\n    for index in indexes:\n        if Sd[index] != tmp_S[index]:#Sd\u3068\u4e00\u81f4\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u3089\n            flg = 1\n    if flg:#flg\u304c\u7acb\u3063\u305f\u6587\u5b57\u5217\u306f\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044\u305f\u3081\u30b9\u30ad\u30c3\u30d7\n        t0 += 1\n        continue\n\n    #?\u306ba\u3092\u7a4d\u3081\u3066\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\n    tmp_S = tmp_S.replace('?', 'a')\n    S_list.append(tmp_S)\n    t0 += 1\n\nif not S_list:\n    print(\"UNRESTORABLE\")\n    return\n\nS_list.sort()#\u8f9e\u66f8\u5f0f\u306b\u30bd\u30fc\u30c8\nprint(S_list[0])", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "def main():\n    s = input()\n    t = input()\n    n = len(s)\n    m = len(t)\n    ans = []\n    for i in range(n-m+1):\n        c = 0\n        for j in range(m):\n            if s[i+j] == '?' or s[i+j] == t[j]:\n                c += 1\n        if c == m:\n            s_ = s[0:i] + t + s[i+m:]\n            s_ = s_.replace('?', 'a')\n            ans.append(s_)\n    if len(ans)>0:\n        print((sorted(ans)[0]))\n    else:\n        print('UNRESTORABLE')\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "S = input()\nSa = S.replace(\"?\", \"a\")\nT = input()\nnt = len(T)\nans = list()\nfor i in range(len(S) - nt + 1):\n    X = S[i: i + nt]\n    for x, t in zip(X, T):\n        if x == \"?\":\n            continue\n        if x != t:\n            break\n    else:\n        ans.append(Sa[:i] + T + Sa[i + nt:])\nans.sort()\nprint((ans[0] if ans else \"UNRESTORABLE\"))\n", "passed": true, "time": 0.16, "memory": 14352.0, "status": "done"}, {"code": "\n# import itertools\n# import math\n# from functools import reduce\n# import sys\n# sys.setrecursionlimit(500*500)\n# import numpy as np\n# import heapq\n# from collections import deque\n\n# N = int(input())\nS_prime = input()\n# n, *a = map(int, open(0))\n# N, M = map(int, input().split())\n# A = list(map(int, input().split()))\n# B = list(map(int, input().split()))\n# tree = [[] for _ in range(N + 1)]\n# B_C = [list(map(int,input().split())) for _ in range(M)]\nT = input()\n\n# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])\n# all_cases = list(itertools.permutations(P))\n# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))\n# itertools.product((0,1), repeat=n)\n\n# A = np.array(A)\n# cum_A = np.cumsum(A)\n# cum_A = np.insert(cum_A, 0, 0)\n\n# def dfs(tree, s):\n#     for l in tree[s]:\n#         if depth[l[0]] == -1:\n#             depth[l[0]] = depth[s] + l[1]\n#             dfs(tree, l[0])\n# dfs(tree, 1)\n\n# def factorization(n):\n#     arr = []\n#     temp = n\n#     for i in range(2, int(-(-n**0.5//1))+1):\n#         if temp%i==0:\n#             cnt=0\n#             while temp%i==0:\n#                 cnt+=1\n#                 temp //= i\n#             arr.append([i, cnt])\n#     if temp!=1:\n#         arr.append([temp, 1])\n#     if arr==[]:\n#         arr.append([n, 1])\n#     return arr\n\n#def make_divisors(n):\n#    lower_divisors , upper_divisors = [], []\n#    i = 1\n#    while i*i <= n:\n#        if n % i == 0:\n#            lower_divisors.append(i)\n#            if i != n // i:\n#                upper_divisors.append(n//i)\n#        i += 1\n#    return lower_divisors + upper_divisors[::-1]\n\n# def gcd_list(numbers):\n#     return reduce(math.gcd, numbers)\n\n# if gcd_list(A) > 1:\n#     print(\"not coprime\")\n#     return\n\n# \u9ad8\u901f\u7d20\u56e0\u6570\u5206\u89e3\u6e96\u5099\n#MAXN = 10**6+10\n#sieve = [i for i in range(MAXN+1)]\n#p = 2\n#while p*p <= MAXN:\n#    if sieve[p] == p:\n#        for q in range(2*p, MAXN+1, p):\n#            if sieve[q] == q:\n#                sieve[q] = p\n#    p += 1\n\nstart_ind = -1\nfor i in range(len(S_prime) - len(T) + 1):\n    for j, c in enumerate(T):\n        if S_prime[i + j] == c or S_prime[i + j] == \"?\":\n            pass\n        else:\n            break\n    else:\n        start_ind = i\n    \nif start_ind == -1:\n    print(\"UNRESTORABLE\")\n    return\n\nS = S_prime[:start_ind] + T + S_prime[start_ind + len(T):]\nprint(S.replace(\"?\", \"a\"))", "passed": true, "time": 0.16, "memory": 14188.0, "status": "done"}, {"code": "_S = list(input())\nT = list(input())\n\nN = len(_S)\nM = len(T)\n\ncandidates = []\n\nfor i in range(N - M + 1):\n    if _S[i] == '?' or _S[i] == T[0]:\n        S = _S.copy()\n        flg = True\n        for j in range(M):\n            if S[i + j] == '?':\n                S[i + j] = T[j]\n            elif S[i + j] != T[j]:\n                flg = False\n                break\n        if flg:\n            for k in range(N):\n                if S[k] == '?':\n                    S[k] = 'a'\n            candidates.append(''.join(S))\n\nif len(candidates) == 0:\n    print('UNRESTORABLE')\nelse:\n    print((min(candidates)))\n", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "s = list(input())\nt = list(input())\nls, lt = len(s), len(t)\n#\u30ea\u30b9\u30c8\u3092\u53cd\u8ee2\u3055\u305b\u3066\u30b1\u30c4\u304b\u3089\u8abf\u3079\u308b\u4e8b\u3067\u8f9e\u66f8\u9806\u6700\u5c0f\u3092\u6c42\u3081\u308b\ns.reverse()\nt.reverse()\nfor i in range(ls):\n    for j in range(lt): #\u3053\u306efor\u6587\u304c\u5168\u90e8\u56de\u308c\u3070t in s\u3067\u3042\u308b\n        if i + j >= ls:\n            break\n        if s[i+j] != '?' and s[i+j] != t[j]:\n            break\n    else: \n        for j in range(lt):\n            s[i+j] = t[j]\n        s = [x if x != '?' else 'a' for x in s]\n        s.reverse()\n        ans = ''.join(s)\n        break\nelse:\n    ans = 'UNRESTORABLE'\nprint(ans)", "passed": true, "time": 0.19, "memory": 14112.0, "status": "done"}, {"code": "import re\ns = input().replace(\"?\",\".\")\nt = input()\nfor i in range(len(s)-len(t),-1,-1):\n  if re.match(s[i:i+len(t)],t):\n    s = s.replace(\".\",\"a\")\n    print(s[:i]+t+s[i+len(t):])\n    return\nprint(\"UNRESTORABLE\")", "passed": true, "time": 0.2, "memory": 14220.0, "status": "done"}, {"code": "ss = input()\nt = input()\n\nls = len(ss)\nlt = len(t)\n\nbefore = []\nafter = []\n\nfor i in range(ls-lt+1):\n    for j in range(lt):\n        if ss[i+j]!=\"?\":\n            if ss[i+j]!=t[j]:\n                break\n    else:\n        before += [ss[:i]+t+ss[i+lt:]]\n  \nfor k in before:\n    after += [k.replace(\"?\",\"a\")]\n\nif after:\n    after = sorted(after)\n    print(after[0])\nelse:\n    print(\"UNRESTORABLE\")", "passed": true, "time": 0.22, "memory": 14060.0, "status": "done"}, {"code": "S = list(input())\nT = list(input())\nS.reverse()\nT.reverse()\nflag = False\nfor i in range(len(S)-len(T)+1):\n    k = 0\n    for t in range(i,i+len(T)):\n        if S[t] != '?' and S[t] != T[k]:\n            break\n        k += 1\n        if k == len(T):\n            flag = True\n            w = i\n    if flag:\n        break\nt = 0\nif flag:\n for i in range(w,w+len(T)):\n    S[i] = T[t]\n    t += 1\n S.reverse()\n an = ''\n for i in range(len(S)):\n    if S[i] == '?':\n        an += 'a'\n    else:\n        an += S[i]\n print(an)\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.38, "memory": 14124.0, "status": "done"}, {"code": "s = input()\nt = input()\n\nans = 'z' * len(s)\ntmp = 'z' * len(s)\n\nx = False\nfor i in range(len(s)-len(t)+1):\n    ok = True\n    for j in range(len(t)):\n        if not (s[i+j] == '?' or s[i+j] == t[j]):\n            ok = False\n    \n    if ok:\n        x = True\n        tmp = s[:i] + t + s[i+len(t):]\n        if ans > tmp:\n            ans = tmp\n\nif x:\n    ans = ans.replace(\"?\", \"a\")\n    print(ans)\nelse:\n    print('UNRESTORABLE')\n", "passed": true, "time": 0.15, "memory": 14268.0, "status": "done"}, {"code": "S=input()\nT=input()\n\nlt=len(T)\nls=len(S)\nS+='%'*lt\n\nif ls<lt:\n    flg=0\nelse:\n    for i in range(ls-lt+1,-1,-1):\n        # print('***',S[i:i+lt])\n        flg=1\n        for j in range(i,i+lt):\n            s=S[j]\n            # print(s,T[j-i])\n            if s=='?': continue\n            if s=='%' or s!=T[j-i]:\n                flg=0\n                break\n        if flg==1:\n            break\nif flg:\n    print((S[0:i]+T+S[i+lt:ls]).replace('?','a'))\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "s = input()\nt = input()\nans = ''\n\n# for i in range(len(s)-len(t)+1):\nfor i in range(len(s)-len(t), -1, -1):\n    st = s[i:i+len(t)]\n    cnt = 0\n    for si, ti in zip(st, t):\n        if si == '?' or si == ti:\n            cnt += 1\n        # print(si, ti, cnt)\n    if cnt == len(t):\n        ans = s[:i] + t + s[i+len(t):]\n        ans = ans.replace('?', 'a')\n        print(ans)\n        return\nelse:\n    print('UNRESTORABLE')\n\n\n", "passed": true, "time": 0.2, "memory": 14284.0, "status": "done"}, {"code": "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return list(map(int, input().split()))\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\n\ndef main():\n    s = input() # \u6697\u53f7\n    t = input() # \u542b\u307e\u308c\u308b\u6587\u5b57\n\n    s_len = len(s)\n    t_len = len(t)\n    flg = False\n\n    for i in range(s_len - t_len,-1,-1):\n        flg = True\n        for j in range(t_len):\n            if s[i+j] != t[j] and s[i+j] != \"?\":\n                flg = False\n                break\n        if flg == True:\n            trial = i\n            break\n\n    if flg == False:\n        print(\"UNRESTORABLE\")\n        return\n\n    ans = \"\"\n    for i in s[:trial]:\n        if i == \"?\":\n            ans = ans + \"a\"\n        else:\n            ans = ans + i\n    ans = ans + t\n\n    for i in s[(trial+t_len):]:\n        if i == \"?\":\n            ans = ans + \"a\"\n        else:\n            ans = ans + i\n\n    print(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.23, "memory": 14408.0, "status": "done"}, {"code": "s = input()[::-1]\nt = input()[::-1]\nx = \"\"\nfor i in range(0,len(s)-len(t)+1):\n    if x == \"\": x = s[i:i+len(t)]\n    else:x = x[1:] + s[i+len(t)-1]\n    flag = True\n    for j in range(len(t)):\n        if x[j] == \"?\" or x[j] == t[j]: continue\n        else: flag = False\n    if flag:\n        s = (s[:i] + t + s[i+len(t):])[::-1]\n        print(s.replace(\"?\", \"a\"))\n        return\nprint(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "S=input()\nT=input()\n\nlt=len(T)\nls=len(S)\nif ls<lt:flg=0\nelse:\n for i in range(ls-lt,-1,-1):\n  flg=1\n  for s,t in zip(S[i:i+lt],T):\n    if s=='?' or s==t: continue\n    flg=0\n  if flg:break\nprint((S[0:i]+T+S[i+lt:ls]).replace('?','a') if flg else 'UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "#!/bin/python3\ns=list(input())\nt=list(input())\n\nlens=len(s)\nlent=len(t)\n\nfor i in reversed(list(range(lens-lent+1))):\n  x=s[i:i+lent]\n  ans=s\n  flag=True\n  #print(\"x\",x,len(x))\n  for j in range(lent):\n    if x[j]!=t[j] and x[j]!=\"?\":\n      flag=False\n      break\n    #if x[j]==\"?\":\n    #  #t\u3068\u540c\u3058\u90e8\u5206\n    #  #print(\"i\",i,\"j\",j)\n    #  ans[i+j]=t[j]\n  if flag:\n    #t\u3088\u308a\u524d\u306e\u90e8\u5206\n    #ans[:i]=[\"a\" if a==\"?\" else a for a in ans[:i]]\n    #t\u3088\u308a\u5f8c\u308d\u306e\u90e8\u5206\n    #if i+lent<=lens:\n    #  ans[i+lent:lens]=[\"a\" if a==\"?\" else a for a in ans[i+lent:lens]]\n    ans=[\"a\" if a==\"?\" else a for a in ans[:i]]+\\\n    \tt+[\"a\" if a==\"?\" else a for a in ans[i+lent:]]\n    print((\"\".join(ans)))\n    return\nprint(\"UNRESTORABLE\")\n#print(\"ans\",ans)\n\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "import sys\nimport math\nimport re\n\n#https://atcoder.jp/contests/agc008/submissions/15248942\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninm = lambda: map(int, sys.stdin.readline().split())\ninl = lambda: list(inm())\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\ns2 = input()\nt = input()\n\n#\u8f9e\u66f8\u9806\u306e\u5c0f\u3055\u3044\u3082\u306e\u3092\u4f5c\u308b\u305f\u3081\u306b\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u306f\u5f8c\u308d\u304b\u3089\u5b9f\u65bd\u3057\u305f\u3044\n#\u306e\u3067\u5165\u529b\u3092\u53cd\u8ee2\u3055\u305b\u308b\ns2_r = s2[::-1]\nt_r = t[::-1]\n\nans_flag = False\n#\u5168\u6587\u5b57\u306e\u7d44\u307f\u5408\u308f\u305b\u3092\u8a66\u3059\nfor i in range(len(s2)):\n    for j in range(i+1,len(s2)+1):\n        #t\u3068\u540c\u3058\u6587\u5b57\u6570\u306e\u6642\u3060\u3051\u90e8\u5206\u4e00\u81f4\u3059\u308b\u304b\u5224\u5b9a\u3059\u308b\n        if (j-i) == len(t_r):\n            flag = True\n            #\u4e00\u6587\u5b57\u3054\u3068\u306b\u5224\u5b9a\u3059\u308b\n            for k,l in enumerate(range(i,j)):\n                if s2_r[l] != t_r[k] and s2_r[l] != '?':\n                    flag = False\n            if flag == True:\n                #\u4e00\u81f4\u3057\u305f\u4f4d\u7f6e\u3092\u7f6e\u63db\n                ans = s2_r[:i] + t_r + s2_r[j:]\n                #\u6b8b\u308a\u306e?\u3092\u8f9e\u66f8\u9806\u6700\u5c0f\u306ea\u306b\u7f6e\u63db\n                ans = ans.replace('?','a')\n                #\u5143\u306e\u9806\u756a\u306b\u53cd\u8ee2\n                ans = ans[::-1]\n                print(ans)                \n                ans_flag = True\n                break\n\n    #for\u3092break\u3057\u306a\u3044\u3068continue\u3059\u308b\n    else:\n        continue\n    break\n            \nif ans_flag == False:\n    print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "S = input()[::-1]\nT = input()[::-1]\n\nflag = False\nfor i in range(len(S) - len(T) + 1):\n    matched = True\n\n    for j in range(len(T)):\n\n        if S[i + j] != \"?\" and S[i + j] != T[j]:\n            matched = False\n            break\n    \n    if matched:\n        S = S[:i] + T + S[i + len(T):]\n        flag = True\n        break\n\nif flag:\n    print(S.replace(\"?\", \"a\")[::-1])\nelse:\n    print(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "S=input()\nT=input()\n\nlt=len(T)\nls=len(S)\nif ls<lt:f=0\nelse:\n for i in range(ls-lt,-1,-1):\n  f=1\n  for s,t in zip(S[i:i+lt],T):\n    if s=='?' or s==t: continue\n    f=0\n  if f:break\nprint((S[0:i]+T+S[i+lt:ls]).replace('?','a') if f else 'UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\nsys.setrecursionlimit(10**6)\n\ns = list(str(input()))\nt = list(str(input()))\n\nans = []\nfor i in range(len(s)-len(t)+1):\n    # print(i)\n    ans_tmp = \"\"\n    for j in range(len(s)):\n        if j >= i and i+len(t) > j:\n            if s[j] == \"?\" or s[j] == t[j-i]:\n                ans_tmp += t[j-i]\n            else:\n                break\n        else:\n            if s[j] == \"?\":\n                ans_tmp += \"a\"\n            else:\n                ans_tmp += s[j]\n\n    if len(ans_tmp) != len(s):\n        continue\n    else:\n        ans.append(ans_tmp)\nans.sort()\n\nif len(ans) == 0:\n    print(\"UNRESTORABLE\")\nelse:\n    print((ans[0]))\n", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\n#import\n#import math\n#import numpy as np\n#= int(input())\nS = list(input())\nT = list(input())\n\nls = len(S); lt = len(T)\n\nfor i in range(ls - lt, -1, -1):\n    isok = True\n    for j in range(lt):\n        if S[i + j] == \"?\":\n            continue\n        if S[i + j] != T[j]:\n            isok = False\n            break\n    if isok:\n        S[i:i+lt] = T\n        ans = \"\"\n        for s in S:\n            if s == \"?\":\n                ans += \"a\"\n            else:\n                ans += s\n        print(ans)\n        return\n\nprint(\"UNRESTORABLE\")\n", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "S = input()\nT = input()\n\nn = len(S)\nl = len(T)\n\nfor i in range(n-l+1)[::-1]:\n  cnt = 0\n  for j in range(l):\n    if S[i+j] == \"?\" or S[i+j] == T[j]:\n      cnt += 1\n  \n  if cnt == l:\n    S = list(S[:i] + T + S[i+l:])\n    for k in range(n):\n      if S[k] == \"?\":\n        S[k] = \"a\"\n    print(\"\".join(S))\n    break\n    \nelse:\n  print(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "def main():\n    s=input()\n    t=input()\n    ans=[]\n    for i in range(len(s)-len(t)+1):\n        for j in range(len(t)):\n            if len(s) <= i+j or (s[i+j] != t[j] and s[i+j] != \"?\"):\n                break\n        else:\n            ans.append((s[:i]+t+s[i+j+1:]).replace(\"?\", \"a\"))\n    ans.sort()\n    print(ans[0] if len(ans) > 0 else \"UNRESTORABLE\")\n    \ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "S=list(input())[::-1]\nT=list(input())[::-1]\nfor i in range(len(S)-len(T)+1):\n  ans = S[:i]\n  for j in range(len(T)):\n    if S[i+j] != \"?\" and S[i+j] != T[j]:\n      break\n    else:\n      ans.append(T[j])\n  else:\n    for j in range(i+len(T),len(S)):\n      ans.append(S[j])\n    print(\"\".join(map(str,ans[::-1])).replace(\"?\",\"a\"))\n    break\nelse:\n  print(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "S = input()\nT = input()\n \nls = len(S)\nlt = len(T)\nleft = -1\n \nfor i in range(ls-lt+1):\n    for j in range(lt):\n        if S[i+j] != \"?\" and S[i+j] != T[j]:\n            break\n    else:\n       left = i\nif left == -1:\n    ans = \"UNRESTORABLE\"\nelse:\n    ans = S[:left]+T+S[left+lt:]\n    ans = ans.replace(\"?\", \"a\")\nprint(ans)", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "s = input()\nt = input()\n\nsoln = \"\"\n\nfor i in range(len(s)-len(t)+1):\n    sol = True\n    for j in range(len(t)):\n        if not (s[i+j] == t[j] or s[i+j] == \"?\"):\n            sol = False\n            break\n\n    if sol:\n        soln = s[:i] + t + s[i+len(t):]\n\nprint(soln.replace(\"?\", \"a\") if soln != \"\" else \"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "import copy\ns = list(input())\nt = list(input())\n\nt1, t2 = copy.deepcopy(s), copy.deepcopy(s)\nok = []\nch = True\nif ch:\n  for i in range(len(s)-len(t)+1):\n    count = 0\n    for j in range(len(t)):\n      if s[i+j] == t[j] or s[i+j] == '?':\n        count += 1\n    if count == len(t):\n      ok.append(i)\nif len(ok) == 0:\n  print(\"UNRESTORABLE\")\n  ch = False\nelse:\n  for i in range(len(t)):\n    t1[ok[0]+i] = t[i]\n  for i in range(len(t)):\n    t2[ok[-1]+i] = t[i]\nif ch:\n  for i in range(len(t1)):\n    if t1[i] == '?':\n      t1[i] = 'a'\n    if t2[i] == '?':\n      t2[i] = 'a'\n  an1, an2 = \"\", \"\"\n  for i in t1:\n    an1 += i\n  for i in t2:\n    an2 += i\n  print(min(an1, an2))", "passed": true, "time": 0.39, "memory": 14184.0, "status": "done"}, {"code": "S = input()\nT = input()\n\nif len(S) < len(T):\n    print('UNRESTORABLE')\n    return\n    \n\nind = None\nfor i in range(len(S)-len(T)+1):\n    for j in range(len(T)):\n        if S[i+j] == \"?\":\n            continue\n        elif S[i+j] == T[j]:\n            continue\n        else:\n            break\n    else:\n        ind = i\n\nif ind == None:\n    print('UNRESTORABLE')\nelse:\n    ans = list(S)\n    for i in range(ind,ind+len(T)):\n        ans[i] = T[i-ind]\n    for i in range(len(ans)):\n        if ans[i] == \"?\":\n            ans[i] = \"a\"\n    print(\"\".join(ans))", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "S = input()\nT = input()\n\nl = len(S)\nk = len(T)\nf = 0\n\n\nif k > l:\n    f = 0\nelse:\n    for i in reversed(list(range(0,l-k+1))):\n        #print(i)\n        for j in range(k):\n            #print(S[i+j], T[j])\n            if S[i + j] != T[j] and S[i + j] != \"?\":\n                #print(i+j)\n                break\n            if j == k-1:\n                f = 1\n                s = i\n        if f == 1:\n            break\n\nif f == 0:\n    print(\"UNRESTORABLE\")\nelse:\n    S = S[:s] + T + S[s+k:]\n    for i in range(l):\n        if S[i] == \"?\":\n            S = S[:i] + \"a\" + S[i+1:]\n    print(S)\n", "passed": true, "time": 0.34, "memory": 14052.0, "status": "done"}, {"code": "s = input()\nt = input()\nn = len(s)\nm = len(t)\nans = []\n\nfor i in range(n-m+1):\n  \t#t\u3068\u540c\u3058\u6587\u5b57\u6570\u3092s\u304b\u3089\u629c\u304d\u51fa\u3059\n    c = 0\n    for j in range(m):\n        if s[i+j] == '?' or s[i+j] == t[j]:\n          \t#s\u306e\u6587\u5b57\u304c\"?\"\u307e\u305f\u306ft[j]\u3068\u540c\u3058\u5834\u5408\n            c += 1\n    if c == m:\n      \t#\u6587\u5b57\u306e\u5909\u63db\n        s_ = s[0:i] + t + s[i+m:]\n        s_ = s_.replace('?', 'a')\n        ans.append(s_)\nif len(ans)>0:\n    print(sorted(ans)[0])\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "import sys\nimport math\nfrom collections import defaultdict\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef main():\n    S = SI()\n    T = SI()\n    ls = len(S)\n    lt = len(T)\n    R = []\n    for i in range(ls-lt+1):\n        SS = S[i:i+lt]\n        is_ok = True\n        for s, t in zip(SS, T):\n            if s != \"?\" and s != t:\n                is_ok = False\n        if not is_ok:\n            continue\n        r = \"\"\n        for j, s in enumerate(S):\n            if j == i:\n                r += T\n            elif i < j < i+lt:\n                pass\n            elif s == \"?\":\n                r += \"a\"\n            else:\n                r += s\n        R.append(r)\n    R.sort()\n    if R:\n        print(R[0])\n    else:\n        print(\"UNRESTORABLE\")\n\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "s = input()\nt = input()\n\nn = len(s)\nm = len(t)\n\nfor i in range(n-m, -1, -1):\n  x = s[i:i+m]\n  for j in range(m+1):\n    if j == m:\n      print(((s[:i]+t+s[i+m:]).replace(\"?\",\"a\")))\n      return\n    if x[j] == \"?\": continue\n    elif x[j] != t[j]: break\n    \nprint(\"UNRESTORABLE\")\n", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "s = input()\nt: str = input()\nn = len(s)\nm = len(t)\n\nfor i in range(n-m, -1, -1):  #-1\u304b\u3089n-m\u56de\u3001\uff11\u305a\u3064\u5f15\u3044\u3066\u3044\u304f\n    tlike = s[i: i+m]\n    if tlike[0] == t[0] or tlike[0] == \"?\":\n        for j in range(m+1):\n            if j == m:\n                print((s[:i] + t + s[i + m:]).replace(\"?\", \"a\"))\n                return\n            if tlike[j] == \"?\":\n                continue\n            elif tlike[j] != t[j]:\n                break\n\nprint(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "# \u89e3\u8aac\u3092\u8aad\u307f\u306a\u304c\u3089\u81ea\u4f5c\n\nS = input()\nT = input()\n\ns_len = len(S)\nt_len = len(T)\n\nres = []\n\ninit_K = \"?\" * s_len\nfor i in range(s_len - t_len + 1):\n    K = list(init_K[:i] + T + init_K[i + t_len:])\n    # K\u3092S\u306b\u3057\u305f\u304c\u3063\u3066\u66f8\u304d\u63db\u3048\u3066\u3044\u304f\u3002\u66f8\u304d\u63db\u3048\u3089\u308c\u306a\u3044\u2192\u6b63\u89e3\u3067\u306f\u306a\u3044\n    for j in range(s_len):\n        if S[j] == \"?\" or S[j] == K[j]:  # S\u304c\"?\"\u307e\u305f\u306fS\u3068K\u304c\u4e00\u81f4\u3001\u66f8\u304d\u63db\u3048\u308b\u5fc5\u8981\u306a\u3057\n            pass\n        elif K[j] == \"?\":  # S\u304c\"?\"\u3067\u306f\u306a\u304f\u3066K\u304c\"?\"\u3001\u66f8\u304d\u63db\u3048\u308b\n            K[j] = S[j]\n        else:  # \u305d\u308c\u4ee5\u5916\u3001\u66f8\u304d\u63db\u3048\u3089\u308c\u306a\u3044\n            break\n    else:  # break\u3057\u306a\u304b\u3063\u305f\n        # \u8f9e\u66f8\u9806\u3067\u6700\u5c0f\u306b\u306a\u308b\u3088\u3046\u306b\u3001\u6b8b\u3063\u305fK\u306e\"?\"\u3092\"a\"\u306b\u5909\u3048\u308b\n        res.append(\"\".join(K).replace(\"?\", \"a\"))\n\nif res:\n    res.sort()\n    print((res[0]))\nelse:\n    print(\"UNRESTORABLE\")\n", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "S=str(input())\nT=str(input())\nls=len(S)\nlt=len(T)\n\nans=''\nloc=None\nfor i in range(ls-lt,-1,-1):\n  flag=0\n  for j in range(lt):\n    if not (S[i+j] == T[j] or S[i+j] == '?'):\n      flag=1\n      break\n  if flag==0:\n    loc=i\n    break\n\nif loc == None:\n  print('UNRESTORABLE')\nelse:\n  i=0\n  while i<ls:\n    if i==loc:\n      ans += T\n      i += lt\n    elif S[i] == '?':\n      ans += 'a'\n      i += 1\n    else:\n      ans += S[i]\n      i += 1\n  print(ans)\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "s = input()\nt = input()\n\nn = len(s)\nk = len(t)\nfor i in range(n - k, -1, -1):\n    ok = True\n    for j in range(k):\n        if s[i + j] == '?' or s[i + j] == t[j]:\n            continue\n        else:\n            ok = False\n            break\n    if ok:\n        print((s[:i].replace('?', 'a') + t + s[i + k:].replace('?', 'a')))\n        return\nprint('UNRESTORABLE')\n", "passed": true, "time": 0.22, "memory": 14252.0, "status": "done"}, {"code": "S=input()\nT=input()\nN=len(S)\nn=len(T)\nans=[]\nfor i in range(N-n+1):\n    for j in range(n):\n        if S[i+j]!=T[j] and S[i+j]!='?':\n            break\n    else:\n        s=[]\n        for j in range(i):\n            if S[j]=='?':\n                s.append('a')\n            else:\n                s.append(S[j])\n        for j in range(i,i+n):\n            s.append(T[j-i])\n        for j in range(i+n,N):\n            if S[j]=='?':\n                s.append('a')\n            else:\n                s.append(S[j])\n        ans.append(''.join(s))\n\nif len(ans)==0:\n    print(\"UNRESTORABLE\")\nelse:\n    ans.sort()\n    print((ans[0]))\n", "passed": true, "time": 0.27, "memory": 14160.0, "status": "done"}, {"code": "S = input()\nT = input()\n\nfor i in range(len(S) - len(T)+1):\n    target = S[len(S) - len(T) - i:len(S) - i]\n\n    can_search = True\n    for key in range(len(T)):\n        if target[key] != '?':\n            if target[key] != T[key]:\n                can_search = False\n                break\n\n    if can_search:\n        new_key = S[:len(S) - len(T) - i]\n        new_key += T\n        new_key += S[len(new_key):]\n        print((new_key.replace('?', 'a')))\n        return\n\nprint('UNRESTORABLE')\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "S = list(input())\nT = list(input())\ns = len(S)\nt = len(T)\nfor i in range(s-t,-1,-1):\n    ss = S[i:i+t]\n    for j in range(t):\n        if ss[j] != \"?\" and ss[j] != T[j]:\n            break\n    else:\n        for j in range(t):\n            if ss[j] == \"?\":\n                S[i+j] = T[j]\n        break\nelse:\n    print(\"UNRESTORABLE\")\n    return\nprint(\"\".join(S).replace(\"?\",\"a\"))", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "S = input()\nT = input()\n\nls = len(S)\nlt = len(T)\nleft = -1\n\nfor i in range(ls-lt+1):\n    for j in range(lt):\n        if S[i+j] != \"?\" and S[i+j] != T[j]:\n            break\n    else:\n       left = i\nif left == -1:\n    ans = \"UNRESTORABLE\"\nelse:\n    ans = S[:left]+T+S[left+lt:]\n    ans = ans.replace(\"?\", \"a\")\nprint(ans)", "passed": true, "time": 0.23, "memory": 14272.0, "status": "done"}, {"code": "import sys\n\ndef accept_input():\n    S = input()\n    T = input()\n    return S,T\n\nS,T = accept_input()\nfromhere = -1\nfor i in range(len(S)-len(T)+1):\n    for j in range(len(T)):\n        if S[i+j] == \"?\":\n            continue\n        elif S[i+j] == T[j]:\n            continue\n        elif S[i+j] != T[j]:\n            break\n    else:\n        fromhere = i\nif fromhere == -1:\n    print(\"UNRESTORABLE\")\n    return\nsd = \"\"\nfor i in range(len(S)):\n    if i < fromhere:\n        if S[i] == \"?\":\n            sd += \"a\"\n        else:\n            sd += S[i]\n    elif i >= fromhere+len(T):\n        if S[i] == \"?\":\n            sd += \"a\"\n        else:\n            sd += S[i]\n    else:\n        sd += T[i-fromhere]\nprint(sd)\n", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "s=input()\nt=input()\n\ns_l=len(s)\nt_l=len(t)\n\nans=[]\nfor i in range(s_l-t_l+1):\n  judge=True\n\n  ts=list(s)\n  for j in range(t_l):\n    if ts[i+j]==t[j]:\n      pass\n    elif ts[i+j]=='?':\n      ts[i+j]=t[j]\n    else:\n      judge=False\n      break\n\n    if judge and j==t_l-1:\n      for k in range(s_l):\n        if ts[k]=='?':\n          ts[k]='a'\n      ans.append(ts)\n\nif ans:\n  ans.sort()\n  print(''.join(ans[0]))\nelse:\n  print('UNRESTORABLE')", "passed": true, "time": 0.15, "memory": 14360.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 28 02:20:36 2020\n\n@author: liang\n\"\"\"\nS = input()\nT = input()\n\nS = S[::-1]\nT = T[::-1]\n\nres = list()\n\nfor i in range(len(S)-len(T)+1):\n    flag = True\n    for j in range(len(T)):\n        if S[i+j] == \"?\" or S[i+j] == T[j]:\n            continue\n        else:\n            flag = False\n    if flag == True:\n        ans = \"\"\n        for k in range(len(S)):\n            if i <= k <= i + len(T)-1:\n                #print(T[k-i])\n                ans += T[k-i]\n            elif S[k] != \"?\":\n                #print(\"B\")\n                ans += S[k]\n            else:\n                #print(\"C\")\n                ans += \"a\"\n        ans = ans[::-1]\n        print(ans)\n        break\n        #res.append(ans)\nelse:\n    print(\"UNRESTORABLE\")\n\"\"\"\nif res:\n    res.sort()\n    print(res[0])\nelse:\n    print(\"UNRESTORABLE\")\n\"\"\"\n#print(S)\n#print(T)\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "s = list(input())\nt = list(input())\nls =len(s)\nlt = len(t)\ns.reverse()\nt.reverse()\nfor i in range(ls):\n    for j in range(lt):\n        if i + j >= ls:\n            break\n        if s[i+j] != '?' and s[i+j] != t[j]:\n            break\n    else:\n        for j in range(lt):\n            s[i+j] = t[j]\n        s = [x if x != '?' else 'a' for x in s]\n        s.reverse()\n        ans = ''.join(s)\n        break\nelse:\n    ans = 'UNRESTORABLE'\nprint(ans)", "passed": true, "time": 0.15, "memory": 14340.0, "status": "done"}, {"code": "S = input()\nT = input()\nanslist = []\nfor i in range(len(S)-len(T)+1):\n    kouho = [0]*len(S)\n    ok = 1\n    for j in range(len(T)):\n        if S[i+j] == T[j] or S[i+j] == \"?\":\n            kouho[i+j] = T[j]\n        else:\n            ok = 0\n            break\n    if ok == 1:\n        for k in range(len(S)):\n            if kouho[k] == 0:\n                if S[k] != \"?\":\n                    kouho[k] = S[k]\n                else:\n                    kouho[k] = \"a\"\n        kouho = ''.join(kouho)\n        anslist.append(kouho)\nif len(anslist) == 0:\n    ans = \"UNRESTORABLE\"\nelse:\n    anslist.sort()\n    ans = anslist[0]\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "import re\nSd = input()\nT = input()\nSdls = list(Sd)\nSdls.reverse()\nSdre = ''.join(Sdls)\nTls = list(T)\nTls.reverse()\nTre = ''.join(Tls)\nst = -1\nfor i in range(0,len(Sd)-len(T)+1):\n    f = 1\n    for j in range(len(T)):\n        if Tre[j] == Sdre[i+j] or Sdre[i+j] == '?':\n            continue\n        else:\n            f = 0\n            break\n    if f == 1:\n        st = i\n        break\nif st == -1:\n    print('UNRESTORABLE')\nelse:\n    Sdrels = list(Sdre)\n    for j in range(len(T)):\n        Sdrels[j+st] = Tre[j]\n    for j in range(len(Sd)):\n        if Sdrels[j] == '?':\n            Sdrels[j] = 'a'\n    ans = ''.join(reversed(Sdrels))\n    print(ans)", "passed": true, "time": 0.15, "memory": 14136.0, "status": "done"}, {"code": "s = input()\nt = input()\nlt = len(t)\nans = []\nfor i in range(len(s)-lt+1):\n    cnt = 0\n    n = 0\n    while n < lt:\n        if s[i+n] == '?':\n            cnt += 1\n        else:\n            if s[i+n] == t[n]:\n                cnt += 1\n        n += 1\n    if cnt == lt:\n        ans.append(list(s[:i] + t + s[i+lt:]))\n        # print(ans)\n        # break\n\nif len(ans) != 0:\n    for a in ans:\n        # print(a)\n        for i in range(len(a)):\n            if a[i] == '?':\n                a[i] = 'a'\n    ans.sort()\n    print(*ans[0], sep='')\n\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "S=input()\nT=input()\n\nlt=len(T)\nls=len(S)\nif ls<lt:flg=0\nelse:\n for i in range(ls-lt,-1,-1):\n  flg=1\n  for j in range(i,i+lt):\n    s=S[j]\n    if s=='?' or s==T[j-i]: continue\n    flg=0\n    break\n  if flg:break\nif flg:\n    print((S[0:i]+T+S[i+lt:ls]).replace('?','a'))\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.23, "memory": 14300.0, "status": "done"}, {"code": "import sys\n#import string\n#from collections import defaultdict, deque, Counter\n#import bisect\n#import heapq\n#import math\n#from itertools import accumulate\n#from itertools import permutations as perm\n#from itertools import combinations as comb\n#from itertools import combinations_with_replacement as combr\n#from fractions import gcd\n#import numpy as np\n\nstdin = sys.stdin\nsys.setrecursionlimit(10 ** 7)\nMIN = -10 ** 9\nMOD = 10 ** 9 + 7\nINF = float(\"inf\")\nIINF = 10 ** 18\n\ndef solve():\n    s = str(stdin.readline().rstrip())\n    t = str(stdin.readline().rstrip())\n    #A, B, C = map(int, stdin.readline().rstrip().split())\n    #l = list(map(int, stdin.readline().rstrip().split()))\n    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]\n    #word = [stdin.readline().rstrip() for _ in range(n)]\n    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]\n    #zeros = [[0] * w for i in range(h)]\n    anss = []\n    for i in range(len(s)-len(t)+1):\n        test = s[i:len(t)+i]\n        flag = True\n        for j in range(len(t)):\n            if test[j] != \"?\" and test[j] != t[j]:\n                flag = False\n        if flag==True:\n            ans = s[0:i] + t + s[i+len(t):]\n            ans = ans.replace(\"?\",\"a\")\n            anss.append(ans)\n    if len(anss) == 0:\n        print(\"UNRESTORABLE\")\n        return\n    anss.sort()\n    print((anss[0]))\n\n\ndef __starting_point():\n    solve()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "S = input()\nT = input()\nlen_S, len_T = len(S), len(T)\nans = []\nfor i in range(len_S-len_T+1):\n\tf = True\n\tfor j in range(len_T):\n\t\tif S[i+j] != T[j] and S[i+j] != '?':\n\t\t\tf = False\n\t\t\tbreak\n\tif f:\n\t\ts = S[:i] + T + S[i+j+1:]\n\t\tans.append(s.replace('?', 'a'))\nif len(ans) == 0:\n\tprint('UNRESTORABLE')\nelse:\n\tans.sort()\n\tprint(ans[0])", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "s = input()\nt = input()\nns = len(s)\nnt = len(t)\n\ncand = []\n\nfor i in range(ns-nt+1):\n    j = 0\n    temps = list(s)\n    f1 = True\n    while j <= nt-1:\n        if temps[i+j] == '?' or temps[i+j] == t[j]:\n            temps[i+j] = t[j]\n        else:\n            f1 = False\n            break\n        j += 1\n    if f1:\n        temps = \"\".join(temps)\n        cand.append(temps.replace('?', 'a'))\n\nif len(cand) == 0:\n    ans = 'UNRESTORABLE'\nelse:\n    cand.sort()\n    ans = cand[0]\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "S=input()\nT=input()\n\nans_list=[]\nfor i in range(len(S)-len(T)+1):\n    X=S[i:i+len(T)]\n    isOK=True\n    for j in range(len(T)):\n        if X[j]==\"?\" or X[j]==T[j]:\n            pass\n        else:\n            isOK=False\n            break\n    \n    if isOK:\n        ans=S[:i]+T+S[i+len(T):]\n        \n        ans=ans.replace('?','a')\n        ans_list.append(ans)\n\nif len(ans_list)<1:\n    print(\"UNRESTORABLE\")\nelse:\n    ans_list.sort()\n    print((ans_list[0]))\n", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "s=list(input())\nt=list(input())\nnum=len(s)-len(t)\nans1=-1\nfor i in range(num+1):\n    num1=0\n    num2=num-i\n    for j in range(len(t)):\n        if s[num2+j]!=t[j] and s[num2+j]!=\"?\":\n            num1=1\n            break\n    if num1==0:\n        ans1=num2\n        break\nif ans1==-1:\n    print(\"UNRESTORABLE\")\nelse:\n    ans=\"\"\n    for i in range(len(t)):\n        s[ans1+i]=t[i]\n    for i in range(len(s)):\n        if s[i]==\"?\":\n            s[i]=\"a\"\n        ans+=s[i]\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "import math\n\nsd = list(input())\nt = list(input())\n\ndic = []\n\nslen = len(sd)\ntlen = len(t)\nfor i in range(slen - tlen + 1):\n    for j in range(tlen):\n        if not (t[j] == sd[i + j] or sd[i + j] == \"?\"):\n            break\n    else:\n        s = sd[:i] + t + sd[i + tlen:]\n        for k in range(len(s)):\n            if s[k] == \"?\":\n                s[k] = \"a\"\n        dic.append(\"\".join(s))\n\nif len(dic) == 0:\n    print(\"UNRESTORABLE\")\n    return\nprint(sorted(dic)[0])", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "S = input()\nT = input()\nls = len(S)\nlt = len(T)\n\nunrestorable = 'z'*50\nans = unrestorable\nfor i in range(ls-lt+1):\n    for j, t in enumerate(T):\n        s = S[i+j]\n        if s != t and s != '?':\n            break\n    else:\n        key = (S[:i]+T+S[i+lt:]).replace('?', 'a')\n        ans = min(ans, key)\n\nprint((ans if ans != unrestorable else 'UNRESTORABLE'))\n", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return list(map(int,input().split()))\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 6)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float(\"inf\")\nal = \"abcdefghijklmnopqrstuvwxyz\"\nAL = al.upper()\n\nS = v()\nT = v()\nlen_s = len(S)\nlen_t = len(T)\ncheck = False\nans = []\n\nif len_s<len_t:\n    print(\"UNRESTORABLE\")\n    return\n\nfor i in range(len_s):\n    if S[i] == \"?\":\n        cnt += 1\n        if cnt >= len_t:\n            aaa = S.replace(\"?\",\"a\")\n            ans.append(aaa[:i-len_t+1]+T+aaa[i+1:])\n    elif S[i] in T:\n        cnt = 0\n        place = T.index(S[i])\n        if len_s<len_t+i-place:\n            break\n        for j in range(i-place,len_t+i-place):\n            if T[j-(i-place)] == S[j] or S[j] == \"?\":\n                check = True\n            else:\n                check = False\n                break\n        if check:\n            aaa = S.replace(\"?\",\"a\")\n            ans.append(aaa[:i-place]+T+aaa[len_t+i-place:])\n    else:\n        cnt = 0\n\nif len(ans)>0:\n    ans.sort()\n    print((ans[0]))\nelse:\n    print(\"UNRESTORABLE\")\n        \n", "passed": true, "time": 0.15, "memory": 14304.0, "status": "done"}, {"code": "S = list(input())\nT = input()\ncandidate = []\n\nans = True\nfor i in range(len(S)):\n    flag = True\n    for j in range(len(T)):\n        if i + j >= len(S):\n            flag = False\n            break\n        if S[i+j] == '?' or S[i+j] == T[j]:\n            pass\n        else:\n            flag = False\n            break\n    if flag:\n        candidate.append(i)\n        ans = False\n\nif ans:\n    print('UNRESTORABLE')\n    return\n\ni = candidate[-1]\nfor tmp in range(i, i + len(T)):\n    S[tmp] = T[tmp-i]\n\n\nfor i in range(len(S)):\n    if S[i] == '?':\n        S[i] = 'a'\n\nprint(''.join(S))", "passed": true, "time": 0.14, "memory": 14388.0, "status": "done"}, {"code": "S=list(input())\nT=list(input())\n\ndef match(s,t):\n  for _s, _t in zip(s, t):\n    if not (_s == _t or _s == '?'):\n      return False\n  return True\n \ndef convert(S):\n  for i in range(len(S)):\n    if S[i] == '?':\n      S[i] = 'a'\n  return S\n\ndef replace(S,T,off):\n  for i in range(len(T)):\n    S[off+i] = T[i]\n  return S\n\npos = -1\nfor i in reversed(range(0,len(S)-len(T)+1)):\n  if match(S[i:], T):\n    pos = i\n    break\n    \nif 0 <= pos:\n  ans = S\n  ans = replace(ans, T, pos)\n  ans = convert(ans)\n  print(*ans,sep=\"\")\nelse:\n  print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n    S_ = SS()\n    T = SS()\n\n    len_S = len(S_)\n    len_T = len(T)\n\n    # T\u306fS'\u306e\u306a\u308b\u3079\u304f\u53f3\u5074\u306b\u3042\u308b\u3079\u304d\n    idx = -1\n    for i in range(len_S - len_T, -1, -1):\n        exists = True\n        for j in range(len_T):\n            if S_[i+j] != '?' and S_[i+j] != T[j]:\n                exists = False\n                break\n        if exists:\n            idx = i\n            break\n\n    if idx == -1:\n        print('UNRESTORABLE')\n    else:\n        ans = list(S_)\n        for i in range(len_S):\n            if S_[i] == '?':\n                if idx <= i < idx + len_T:\n                    ans[i] = T[i-idx]\n                else:\n                    ans[i] = 'a'\n\n        print((''.join(ans)))\n\ndef __starting_point():\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14408.0, "status": "done"}, {"code": "s_ = input()\nt_ = input()\ns = [c for c in s_]\nt = [c for c in t_] \nn = len(s)\nm = len(t)\nfor i in reversed(list(range(m-1, n))):\n    replaced = 0\n    if s[i]==t[-1] or s[i]==\"?\":\n        k = i-1\n        \"\"\"\n        if k+1<m-1:\n            continue\n        \"\"\"\n        replace = 1\n        for j in reversed(list(range(m-1))):\n            if s[k]==t[j] or s[k]==\"?\":\n                if j==0:\n                    replace=1\n                    break\n            else:\n                replace = 0\n                break\n            k -= 1\n\n        if replace:\n            k = i\n            for j in reversed(list(range(m))):\n                s[k] = t[j]\n                k -= 1\n            replaced = 1\n    if replaced:\n        break\nif n < m:\n    replaced=0\nif replaced:\n    for i in range(n):\n        if s[i]==\"?\":\n            s[i]=\"a\"\n    print((\"\".join(s)))\nelse:\n    print(\"UNRESTORABLE\")\n", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "S = input()\nT = input()\ndef match(s,t):\n    for c,d in zip(s,t):\n        if c == \"?\":\n            continue\n        elif c == d:\n            continue\n        else:\n            return False\n    return True\nfor i in range(len(S)-len(T), -1, -1):\n    s = S[i:i+len(T)]\n    if match(s, T):\n        print((S[:i]+T+S[i+len(T):]).replace(\"?\",\"a\"))\n        return\nprint(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "S_p=input()\nT=input()\n\nk=[]\nfor i in range(len(S_p)-len(T)+1):\n\tS_sub = S_p[i:i+len(T)]\n\tif all(s in (t, \"?\") for s, t in zip(S_sub, T)):\n\t\tk.append(i)\n\n\nif k:\n\tS=S_p[:k[-1]]+T+S_p[k[-1]+len(T):]\n\tprint(S.replace(\"?\", \"a\"))\nelse:\n\tprint(\"UNRESTORABLE\")", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "s = list(input())\nt = list(input())\nn = len(s)\nm = len(t)\nk = -1\nfor i in range(n-m+1):\n    x = s[i:i+m]\n    flg = True\n    for j in range(m):\n        if x[j] != '?' and x[j] != t[j]:\n            flg = False\n            break\n    if flg:\n        k = i\nif k != -1:\n    for i in range(k,k+m):\n        s[i] = t[i-k]\n    for i in range(n):\n        if s[i] == '?':\n            s[i] = 'a'\n    print(''.join(s))\nelse:\n    print('UNRESTORABLE')", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}]