結果

問題 No.2226 Hello, Forgotten World!
ユーザー gr1msl3ygr1msl3y
提出日時 2023-03-18 15:36:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 81,672 KB
実行使用メモリ 64,132 KB
最終ジャッジ日時 2023-10-18 17:20:30
合計ジャッジ時間 1,500 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

T='helloworld'
def solve(N,S):
    for i in range(N-10,-1,-1):
        for j in range(10):
            if S[i+j]!='?' and S[i+j]!=T[j]:
                break
        else:
            res=[]
            for j in range(N):
                if i<=j<i+10:
                    res.append(T[j-i])
                elif S[j]=='?':
                    res.append('a')
                else:
                    res.append(S[j])
            return ''.join(res)
    return '-1'

t=int(input())
ans=[]
for _ in range(t):
    N=int(input())
    S=input()
    ans.append(solve(N,S))

print(*ans,sep='\n')
0