結果
| 問題 |
No.2226 Hello, Forgotten World!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-24 22:13:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,005 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 72,976 KB |
| 最終ジャッジ日時 | 2024-09-13 05:36:43 |
| 合計ジャッジ時間 | 1,324 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 9 |
ソースコード
hw = list("helloworld")
def solve():
n = int(input())
s = input()
p = []
q = []
h = []
for i in range(0,n-10+1):
flg = 1
for j in range(10):
if s[i+j] == hw[j] or s[i+j] == "?": continue
flg = 0
if flg:
p.append(i)
if s[i] == "h":
h.append(i)
else:
q.append(i)
if not p:
print(-1)
return
for i in range(len(p)):
pi = p[i]
flg = 1
for j in range(10):
if s[pi+j] == "?":
flg = 0
if flg:
st = []
for j in range(n):
if s[j] == "?":
st.append("a")
else:
st.append(s[j])
print("".join(st))
break
else:
st = []
pi = p[-1]
for i in range(pi):
if s[i] == "?":
st.append("a")
else:
st.append(s[i])
st += hw
for i in range(pi+10, n):
if s[i] == "?":
st.append("a")
else:
st.append(s[i])
print("".join(st))
return
t = int(input())
for i in range(t):
solve()