結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2024-07-17 01:59:31 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 71 ms / 5,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 64,828 KB |
最終ジャッジ日時 | 2024-07-17 01:59:42 |
合計ジャッジ時間 | 1,726 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
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 - 1 assert False xs = [(s, count_w(s)) for s in cands] if not xs: print() exit() _, max_wcnt = max(xs, key=lambda x: x[1]) for s, wcnt in xs: if wcnt == max_wcnt: print(s[:-wcnt])