提出 #31081926


ソースコード 拡げる

s = input()
t = input()
def solve():
    for i in range(len(s) - len(t), -1, -1):
    # i = len(s) - len(t), ..., 0 (1 ずつ減らす)
        is_ok = 1
        for j in range(len(t)):
            if s[i + j] != "?" and s[i + j] != t[j]:
                is_ok = 0
        if is_ok == 0:
            continue
        answer = ""
        for j in range(i):
            if s[j] == "?":
                answer += "a"
            else:
                answer += s[j]
        answer += t
        for j in range(i + len(t), len(s)):
            if s[j] == "?":
                answer += "a"
            else:
                answer += s[j]
        print(answer)
        return
    print("UNRESTORABLE")
solve()

提出情報

提出日時
問題 C - Dubious Document 2
ユーザ Pro_ktmr
言語 PyPy3 (7.3.0)
得点 300
コード長 730 Byte
結果 AC
実行時間 71 ms
メモリ 61420 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 14
セット名 テストケース
Sample s1.txt, s2.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, s1.txt, s2.txt
ケース名 結果 実行時間 メモリ
in01.txt AC 71 ms 61344 KiB
in02.txt AC 49 ms 61348 KiB
in03.txt AC 49 ms 61364 KiB
in04.txt AC 50 ms 61420 KiB
in05.txt AC 51 ms 61276 KiB
in06.txt AC 51 ms 61368 KiB
in07.txt AC 51 ms 61364 KiB
in08.txt AC 51 ms 61344 KiB
in09.txt AC 51 ms 61084 KiB
in10.txt AC 51 ms 61368 KiB
in11.txt AC 48 ms 61328 KiB
in12.txt AC 51 ms 61264 KiB
s1.txt AC 52 ms 61364 KiB
s2.txt AC 51 ms 61388 KiB