#include <stdio.h>

int abs(int a) {
    return (a>0? a:-a);
}

int max(int a, int b) {
    return (a>b ? a:b);
}

int main() {
    int x, y;
    char s1[5], s2[5];
    scanf("%s %s", s1, s2);

    x=abs(s1[0]-s2[0]);
    y=abs(s1[1]-s2[1]);

    printf("%d %d", max(x, y), x+y-max(x,y));
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: