--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+
+my $count = 0;
+
+while (<>) {
+ my ($min, $max, $letter, $pass) = /\A(\d+)-(\d+)\s+(\S):\s+(\S+)\s*\z/;
+ if (!defined $pass) {
+ print "Divny radek $_\n";
+ next;
+ }
+
+ no warnings 'substr';
+ # no warnings 'uninitialized';
+ $count++ if !!(substr($pass, $min-1, 1) eq $letter)
+ + !!(substr($pass, $max-1, 1) eq $letter)
+ == 1;
+}
+
+print $count, "\n";
+