結果

問題 No.2226 Hello, Forgotten World!
ユーザー AngrySadEight
提出日時 2022-12-09 00:40:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 793 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 81,976 KB
実行使用メモリ 76,244 KB
最終ジャッジ日時 2024-06-24 21:21:55
合計ジャッジ時間 1,828 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N = int(input())
    S = str(input())
    
    ans = ''
    hello = 'helloworld'
    pos = False
    for i in range(N):
        ans += 'z'
    for i in range(N - 9):
        possub = True
        anssub = ''
        for j in range(10):
            if S[i + j] != '?' and S[i + j] != hello[j]:
                possub = False
        if possub:
            pos = True
            for j in range(N):
                if 0 <= j - i < 10:
                    anssub += hello[j - i]
                else:
                    if S[j] == '?':
                        anssub += 'a'
                    else:
                        anssub += S[j]
            if ans > anssub:
                ans = anssub
    if pos:
        print(ans)
    else:
        print(-1)
0