#!/usr/bin/perl -w

use strict;
use v5.30;

my $count;

line:
while (<>) {
	chomp;
	my $super = $_;
	$super =~ s/\[.*?\]/---/g;
	my $hyper = join('---', ($_ =~ /\[([^\]]*)\]/g));
	while ($super =~ /(\w)(?!\1)(\w)\1/g) {
		pos($super)-= 2;
		my $s = "$2$1$2";
		if ($hyper =~ /$s/) {
			$count++;
			next line;
		}
	}
}

say $count;
