use strict; chomp(my $s = <>); chomp(my $t = <>); if (length($t) == 1 || $t =~ /^\.+$/) { print("-1\n"); exit 0; } my $c = 0; while ($s =~ /(\Q$t\E)/g) { $c++; } print($c, "\n");