結果
問題 |
No.2298 yukicounter
|
ユーザー |
![]() |
提出日時 | 2025-03-20 20:18:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 82,360 KB |
実行使用メモリ | 72,596 KB |
最終ジャッジ日時 | 2025-03-20 20:20:00 |
合計ジャッジ時間 | 2,610 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
S = input().strip() pattern = 'yukicoder' pattern_length = len(pattern) starts = [] start = 0 while True: pos = S.find(pattern, start) if pos == -1: break starts.append(pos) start = pos + pattern_length # Move past the current occurrence if not starts: print(0) else: max_k = 1 current_k = 1 for i in range(1, len(starts)): if starts[i] == starts[i-1] + pattern_length: current_k += 1 if current_k > max_k: max_k = current_k else: current_k = 1 # Reset for a new potential sequence print(max_k)