結果

問題 No.345 最小チワワ問題
ユーザー teio
提出日時 2020-07-25 08:53:05
言語 Perl
(5.40.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-26 21:08:58
合計ジャッジ時間 1,677 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

# use strict;
# use warnings;

chomp(my $S = <>);
my @r;
my $c = 0;
while ($S =~ /c.*?w.*?w/g) {
    push(@r, length(substr($S, $-[0], $+[0] - $-[0])));
    $c++;
    pos($S) = $c;
}
print(scalar(@r) ? (sort({$a <=> $b} @r))[0] : -1, "\n");
0