結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2024-07-17 01:36:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 53 ms / 5,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 665 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 53,312 KB |
最終ジャッジ日時 | 2024-07-17 01:37:06 |
合計ジャッジ時間 | 2,129 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
S = input() w = 'w' while S and S[0] == w: S = S[1:] ps = [] max_wcnt = 0 cands = [] p = 0 while (q := S.find(w, p)) != -1: i = q while i < len(S) and S[i] == w: i += 1 if i-q > max_wcnt: max_wcnt = i-q cands.clear() if i-q == max_wcnt: cands.append(q) p = i for i in cands: p = i-1 res = [] while p >= 0 and S[p] != w: res.append(S[p]) p -= 1 print(''.join(reversed(res)))