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

my $prevcom = "";
my %commands;

while(<>) {
  chomp;
  my ($command) = (/^(\S+)/xms);

  $commands{"$prevcom; $command"}++ if ($prevcom);

  $prevcom = $command;
}

foreach my $key (sort { $commands{$a} <=> $commands{$b} } keys %commands) {
  say "$key: $commands{$key}";
}
