結果

問題 No.342 一番ワロタww
ユーザー latte0119
提出日時 2016-02-24 15:25:01
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 523 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-22 13:19:19
合計ジャッジ時間 2,381 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s=gets

tmp=s.count('w')

if tmp==0||tmp==s.size then
    exit
end

while s[0]=='w' do
    s=s[1,s.size-1]
end

while s[s.size-1]!='w' do
    s=s[0,s.size-1]
end

ma=0
lis=[]

while s.size!=0 do
    c=0
    while c<s.size&&s[c]!='w' do
        c+=1
    end
    ss=s[0,c]
    s=s[c,s.size-c]
    
    c=0
    while c<s.size&&s[c]=='w' do
        c+=1
    end
    s=s[c,s.size-c]
    if ma<c then
        lis=[ss]
        ma=c
    elsif ma==c then
        lis.push(ss)
    end
end

for e in lis
    print e+"\n"
end
0