結果

問題 No.2298 yukicounter
ユーザー simansiman
提出日時 2023-05-13 10:50:23
言語 Ruby
(3.4.1)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,952 KB
最終ジャッジ日時 2024-11-29 04:55:03
合計ジャッジ時間 7,319 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

S = gets.chomp
T = 'yukicoder'

idx = 0
cnt = 0
ans = 0

S.each_char do |s|
  if s == T[idx]
    idx = (idx + 1) % 9

    cnt += 1 if idx == 0
  else
    ans = cnt if ans < cnt
    cnt = 0
    idx = 0
  end
end

ans = cnt if ans < cnt
puts ans
0