結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2024-07-17 01:54:44 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 66,380 KB |
最終ジャッジ日時 | 2024-07-17 01:54:47 |
合計ジャッジ時間 | 2,154 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | WA * 11 RE * 3 |
ソースコード
import re S = input() w = 'w' while S and S[0] == w: S = S[1:] reg = re.compile('^[^w]+w+') s = S cands = [] while m := reg.match(s): t = m.group(0) if t[0] != w: cands.append(t) s = s[len(t):] def count_w(s: str) -> int: for i in reversed(range(len(s))): if s[i] != w: return len(s) - i assert False xs = [(s, count_w(s)) for s in cands] _, max_wcnt = max(xs, key=lambda x: x[1]) for s, wcnt in xs: if wcnt == max_wcnt: print(s[:wcnt])