結果

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

ソースコード

diff #

input = gets.chomp
size = input.size
for i in 0..size-1
    if input[i] == "c"
        x = i
        next
    end
    if input[i] == "w"
        y = i
        next
    end
end

if x < y
    puts y - x + 1
else
    puts -1
end
0