Subtract the two characters from each other making the result positive if it's negative.
From there, the answer is either that value, or if it's more than 13, it's 26 - value.
char a = '<SOME LETTER>';
char b = '<SOME LETTER>';
char distance = abs(a-b);
if (distance > 13) {
distance = 26 - distance;
}