結果

問題 No.345 最小チワワ問題
ユーザー mesh1nek0x0
提出日時 2018-07-28 11:45:45
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 152 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-05 18:21:12
合計ジャッジ時間 3,391 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:9: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

#!/bin/ruby
S = gets.chomp
cwws = S.scan(/c.*?w.*?w.*?/)

if cwws.any?
  cwws.sort { |a, b| a.size <=> b.size }
  puts cwws[0].length
else
  puts -1
end
0