結果

問題 No.1005 BOT対策
ユーザー shi-mo
提出日時 2020-09-30 21:01:42
言語 Ruby
(3.4.1)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 177 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 8,192 KB
実行使用メモリ 14,080 KB
最終ジャッジ日時 2025-06-20 00:54:34
合計ジャッジ時間 3,644 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.chomp
t = gets.chomp

if 1 == t.length
  puts s.include?(t) ? '-1' : 0
  return
end

c = 0
tdot = t[0..-2] + '.' + t[-1]
while s.sub!(/#{t}/o, tdot)
  c += 1
end
puts c
0