結果

問題 No.2226 Hello, Forgotten World!
コンテスト
ユーザー AP25
提出日時 2026-06-18 15:29:00
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 523 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 422 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 53,504 KB
最終ジャッジ日時 2026-06-18 15:29:02
合計ジャッジ時間 1,426 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

T = int(input())

word = "helloworld"
num = len(word)

for _ in range(T):

    N = int(input())
    S = list(input())

    idx = -1
    for s in range(N-num+1):
        if S[s] != "h" and S[s] != "?":
            continue

        if all(S[s+i] == word[i] or S[s+i] == "?" for i in range(num)):
            idx = s
            break

    if idx == -1:
        print(-1)
        continue

    for i in range(num):
        if S[idx+i] == "?":
            S[idx+i] = word[i]

    print("".join(S))
0