use strict;
use warnings;
use Carp;
#use Data::Dumper;

my $filename = shift;
open my $fh, '<', $filename or croak;
#my @rows;
my $c = 0;
my $f = 0;
my $g = 0;
my $j = 0;

while (<$fh>) {
	chomp;
#	push @rows, $_;
#	if (/\x{c2}/) {
	if (/\x{65}/) {
#		$c++;
	}
	my $d = () = (/\x{c2}/g);
	my $e = () = (/\x{c2}\x{ad}/g);
	my $h = () = (/./g);
	my $i = () = (/\x{ad}/g);	
	if (/\x{c2}(?!\x{ad})/g) {
#		print "$_\n";
	}
	if (/(\x{c2}(?!\x{ad}))/g) {
#		print "$2\n"; # ?!
	}
#	if (/\x{c2}(?!\x{ad})/g) {
#		if (/(...\x{c2}...)/) {
#			print "$1\n";
#		}		
#	}			
#	print "$d\n";
	$c += $d;
	$f += $e;
	$g += $h;
	$j += $i;		
}
# ascii code 00 is null it can be used as a prefix indicating the next two bytes are a character similarly for 00 00 for four bytes
# so far we've tried this in a very bizarre way where 65 is a for example and 02 is b and 6502 is an axe in chinese it kind of works
# provided you never mix text types or you stick to a particular codepage which generally stick to text types just to be boring
#print Dumper(@rows);
print "$c\n";
print "$f\n";
print "$j\n";
print "$g\n";

