結果
| 問題 | No.1005 BOT対策 | 
| コンテスト | |
| ユーザー |  hogehoge | 
| 提出日時 | 2021-01-02 21:00:06 | 
| 言語 | Perl (5.40.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 302 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 6,816 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-12 10:59:52 | 
| 合計ジャッジ時間 | 1,037 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 WA * 2 | 
コンパイルメッセージ
Main.pl syntax OK
ソースコード
use strict;
chomp(my $s = <>);
chomp(my $t = <>);
my $c = 0;
if ($t =~ /^(.)\1+$/) {
    while ($s =~ s/(\Q$t\E)//) {
        $c++;
    }
} else {
    while ($s =~ /(\Q$t\E)/g) {
        $c++;
    }
}
if ($c && (length($t) == 1 || $t =~ /^\.+$/)) {
    print("-1\n");
} else {
    print($c, "\n");
}
            
            
            
        