fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. char f1, f2;
  7. int s1, s2, x, y;
  8. cin >> f1>> s1;
  9. cin >>f2 >> s2;
  10. x = abs(f1 - f2);
  11. y = abs(s1 - s2);
  12. cout << min(x, y) << ' ' << max(x, y);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 15232KB
stdin
a1
b3
stdout
1 2