結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-24 22:50:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 292 ms / 2,000 ms |
| コード長 | 689 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 82,316 KB |
| 実行使用メモリ | 76,108 KB |
| 最終ジャッジ日時 | 2024-09-13 05:53:53 |
| 合計ジャッジ時間 | 1,826 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
hello = "helloworld"
def solve():
n = int(input())
S = input()
ans = "{"
for i in range(n-9):
ok = 1
for j in range(10):
if S[i+j] != "?" and S[i+j] != hello[j]:
ok = 0
if ok == 0:
continue
cand = []
for j,s in enumerate(S):
if i <= j < i+10:
cand.append(hello[j-i])
else:
if s == "?":
s = "a"
cand.append(s)
cand = "".join(cand)
if cand < ans:
ans = cand
if ans == "{":
ans = -1
return ans
t = int(input())
for _ in range(t):
print(solve())