結果

問題 No.342 一番ワロタww
ユーザー brookbrook
提出日時 2016-02-12 23:22:28
言語 Ruby
(3.2.2)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 491 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 11,348 KB
実行使用メモリ 15,284 KB
最終ジャッジ日時 2023-08-05 16:05:39
合計ジャッジ時間 2,430 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,284 KB
testcase_01 AC 86 ms
15,280 KB
testcase_02 AC 78 ms
15,148 KB
testcase_03 AC 78 ms
15,280 KB
testcase_04 AC 79 ms
15,172 KB
testcase_05 AC 82 ms
15,120 KB
testcase_06 AC 80 ms
15,100 KB
testcase_07 AC 81 ms
15,272 KB
testcase_08 AC 80 ms
15,144 KB
testcase_09 AC 80 ms
15,056 KB
testcase_10 AC 82 ms
15,052 KB
testcase_11 AC 79 ms
15,204 KB
testcase_12 AC 78 ms
15,120 KB
testcase_13 AC 82 ms
15,148 KB
testcase_14 AC 79 ms
15,156 KB
testcase_15 AC 78 ms
15,276 KB
testcase_16 AC 78 ms
15,156 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.chomp.split('')
t = {}
w = 0
max = 0
tmp = ''
loop do
  if s[0] == 'w'
    s.shift
  else
    break
  end
end
s.each do |v|
  if v == 'w'
    w += 1
    if w > max
      max = w
    end
  else
    if w != 0
      if t[w].nil?
        t[w] = tmp
      else
        t[w] +=  "\n" + tmp 
      end
      w = 0
      tmp = v
    else
      tmp += v
    end
  end
end
if max > 0
  if t[w].nil?
    t[w] = tmp
  else
    t[w] += "\n" + tmp
  end
  puts t[max].strip
else
  puts ''
end
0