結果

問題 No.2226 Hello, Forgotten World!
ユーザー nephrologistnephrologist
提出日時 2023-02-25 18:25:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 76,676 KB
最終ジャッジ日時 2023-10-11 15:26:48
合計ジャッジ時間 1,896 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,048 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 #

import sys

input = sys.stdin.readline
hoge = list("helloworld")
t = int(input())
for _ in range(t):
    n = int(input())
    s = list(input().rstrip())
    if n < 10:
        print(-1)
        continue
    ans = -1
    for start in range(n - 9):
        okflag = 1
        for i in range(10):
            if s[start + i] == hoge[i] or s[start + i] == "?":
                continue
            else:
                okflag = 0
                break
        if okflag:
            ans = start

    if ans == -1:
        print(ans)
        continue
    for i in range(10):
        s[ans + i] = hoge[i]
    for i in range(n):
        if s[i] == "?":
            s[i] = "a"
    print("".join(s))
    # exit()
0