結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2016-02-13 01:29:37 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 397 bytes |
コンパイル時間 | 40 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-09-22 05:23:36 |
合計ジャッジ時間 | 2,216 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.chomp.gsub(/^w/, '') cnt, longest = 0, 0 s.split('').each do |c| if c == 'w' cnt += 1 longest = longest < cnt ? cnt : longest else cnt = 0 end end if longest == 0 or longest == s.length puts exit true end regex = Regexp.new("[^w]+?w{#{longest}}") arr = s.scan(regex) if arr.length == 0 puts exit true end puts arr.map{|item| item.gsub(/w+/, '')}