結果

問題 No.2226 Hello, Forgotten World!
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-02-24 22:23:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 745 bytes
コンパイル時間 1,767 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 80,396 KB
最終ジャッジ日時 2023-10-11 06:27:27
合計ジャッジ時間 2,772 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
79,184 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from re import A


hello = "helloworld"

def solve():
    n = int(input())
    S = input()

    if hello in S:
        ans = []
        for s in S:
            if s == "?":
                s = "a"
            ans.append(s)

        return "".join(ans)


    for i in range(n-10,-1,-1):
        ok = 1
        for j in range(10):
            if S[i+j] != "?" and S[i+j] != hello[j]:
                ok = 0

        if ok == 0:
            continue
        S = list(S)
        for j in range(10):
            S[i+j] = hello[j]

        ans = []
        for s in S:
            if s == "?":
                s = "a"
            ans.append(s)

        return "".join(ans)

    return -1        

t = int(input())
for _ in range(t):
    print(solve())
0