#!/usr/bin/perl -w 
use strict;

chomp(my $old = <>);
my $temp1;
my $temp2;
my $count;
my $i;

while(<>) {
    $count = 0;
    chomp($_);

    for($i=0;$i<length($_);$i++) {
	if(/[10]{$i}([10])/) {
	    $temp1 = $1;
	}
	else {die("failure on new bit ".$i." get");}
	if($old =~ m/[10]{$i}([10])/) {
	    $temp2 = $1;
	}
	else {die("failure on old bit ".$i." get");}

	if($temp1 ne $temp2) {$count++;}

    }
    if($count > 1 or $count == 0) {
	die("apgc failed bad bit change");
    }
    $old = $_;
}

