結果
問題 |
No.2226 Hello, Forgotten World!
|
ユーザー |
![]() |
提出日時 | 2023-03-01 11:19:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 82,300 KB |
実行使用メモリ | 83,012 KB |
最終ジャッジ日時 | 2024-09-16 10:31:07 |
合計ジャッジ時間 | 1,666 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import copy h = 'helloworld' for _ in range(int(input())): n = int(input()) s = list(input()) ans = [] for i in range(len(s) - len(h), -1, -1): flag = True for j in range(len(h)): if s[i + j] == '?' or s[i + j] == h[j]: continue else: flag = False if flag: t = copy.copy(s) for j in range(len(h)): t[i + j] = h[j] ans.append(''.join(t).replace('?', 'a')) ans.sort() # print(ans) if ans: print(ans[0]) else: print(-1)