#!/usr/bin/perl
use strict;
use warnings;
use utf8;

my $block;
my %count;

while(<>) {
    if ($_ eq "\n") {
        $count{$block}++;
        $block = "";
    }
    else {
        $block .= $_;
    }
}

while (my ($text, $count) = each %count) {
    print $text;
    print "\t$count\n";
}
