#!/usr/bin/perl -w

use v5.36;
use strict;
use experimental 'multidimensional';

my $sum;
while (<>) {
	chomp;
	my $len = length;
	my ($l, $r) = (substr($_, 0, $len/2), substr($_, $len/2));
	for my $c (split(//, $l)) {
		next if $r !~ /$c/;
		$sum += ord($c) - ord('A') + 27 if $c =~ /[A-Z]/;
		$sum += ord($c) - ord('a') +  1 if $c =~ /[a-z]/;
		say $c;
		last;
	}
}
say $sum;
