
while ( $seq = <STDIN> )
{
	$charge = 0;
	chomp( $seq );
	@AAs = split( //, $seq);
	foreach $aa ( @AAs )
		{
			if ( $aa eq "K" || $aa eq "R" ) 
				{ $charge++; }
			if ( $aa eq "D" || $aa eq "E" )
				{ $charge--; }
		}

print "The charge is: $charge\n";
}
