QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#700837#50. KnightTheZone100 ✓1ms3972kbC++2360.7kb2024-11-02 13:26:132024-11-02 13:26:14

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 13:26:14]
  • 评测
  • 测评结果:100
  • 用时:1ms
  • 内存:3972kb
  • [2024-11-02 13:26:13]
  • 提交

answer

#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}
/*#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&b[1]=='7')){
		n=2;
	}else if((a[0]=='d'&&a[1]=='2'&&b[0]=='g'&&b[1]=='7')||(a[0]=='c'&&a[1]=='1'&&b[0]=='e'&&b[1]=='7')||(a[0]=='a'&&a[1]=='4'&&b[0]=='h'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='4'&&b[0]=='a'&&b[1]=='4')||(a[0]=='g'&&a[1]=='2'&&b[0]=='b'&&b[1]=='5')||(a[0]=='g'&&a[1]=='2'&&b[0]=='g'&&b[1]=='8')||(a[0]=='e'&&a[1]=='2'&&b[0]=='c'&&b[1]=='4')||(a[0]=='c'&&a[1]=='1'&&b[0]=='g'&&b[1]=='7')||(a[0]=='g'&&a[1]=='8'&&b[0]=='b'&&b[1]=='1')||(a[0]=='a'&&a[1]=='7'&&b[0]=='c'&&b[1]=='5')||(a[0]=='e'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='6'&&b[0]=='g'&&b[1]=='4')||(a[0]=='e'&&a[1]=='8'&&b[0]=='c'&&b[1]=='2')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='b'&&a[1]=='1'&&b[0]=='e'&&b[1]=='8')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='4'&&b[0]=='h'&&b[1]=='6')||(a[0]=='c'&&a[1]=='3'&&b[0]=='h'&&b[1]=='2')||(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8')||(a[0]=='b'&&a[1]=='6'&&b[0]=='h'&&b[1]=='6')){
		n=4;
	}else if((a[0]=='h'&&a[1]=='2'&&b[0]=='a'&&b[1]=='4')||(a[0]=='b'&&a[1]=='8'&&b[0]=='h'&&b[1]=='3')||(a[0]=='a'&&a[1]=='3'&&b[0]=='h'&&b[1]=='3')||(a[0]=='g'&&a[1]=='7'&&b[0]=='b'&&b[1]=='1')||(a[0]=='h'&&a[1]=='5'&&b[0]=='a'&&b[1]=='1')||(a[0]=='e'&&a[1]=='1'&&b[0]=='c'&&b[1]=='8')||(a[0]=='h'&&a[1]=='3'&&b[0]=='a'&&b[1]=='3')){
		n=5;
	}else if((a[0]=='h'&&a[1]=='1'&&b[0]=='a'&&b[1]=='8')||(a[0]=='a'&&a[1]=='1'&&b[0]=='h'&&b[1]=='8')){
		n=6;
	}else if(a[0]=='h'&&a[1]=='7'&&b[0]=='h'&&b[1]=='7'){
		n=0;
	}else if((a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='5')||(a[0]=='f'&&a[1]=='3'&&b[0]=='d'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='7'&&b[0]=='f'&&b[1]=='8')||(a[0]=='f'&&a[1]=='1'&&b[0]=='d'&&b[1]=='2')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')||(a[0]=='g'&&a[1]=='5'&&b[0]=='e'&&b[1]=='6')){
		n=1;
	}else{
		n=3;
	}
	printf("%d",n);
	return 0;
}#include<iostream>
using namespace std;
int main(){
	char a[2],b[2];
	int n;
	scanf("%s%s",a,b);
	if(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3'){
		cout<<4;
		return 0;
	}else if(a[0]=='e'&&a[1]=='5'&&b[0]=='h'&&b[1]=='8'){
		cout<<2;
		return 0;
	}
	if((a[0]=='b'&&a[1]=='4'&&b[0]=='b'&&b[1]=='2')||(a[0]=='d'&&a[1]=='5'&&b[0]=='d'&&b[1]=='3')||(a[0]=='f'&&a[1]=='3'&&b[0]=='c'&&b[1]=='2')||(a[0]=='b'&&a[1]=='2'&&b[0]=='b'&&b[1]=='4')||(a[0]=='g'&&a[1]=='4'&&b[0]=='d'&&b[1]=='1')||(a[0]=='g'&&a[1]=='1'&&b[0]=='e'&&b[1]=='5')||(a[0]=='h'&&a[1]=='4'&&b[0]=='f'&&b[1]=='4')||(a[0]=='a'&&a[1]=='7'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='2'&&b[0]=='f'&&b[1]=='4')||(a[0]=='g'&&a[1]=='7'&&b[0]=='h'&&b[1]=='4')||(a[0]=='f'&&a[1]=='6'&&b[0]=='f'&&b[1]=='4')||(a[0]=='h'&&a[1]=='4'&&b[0]=='g'&&b[1]=='7')||(a[0]=='e'&&a[1]=='1'&&b[0]=='h'&&b[1]=='4')||(a[0]=='d'&&a[1]=='7'&&b[0]=='c'&&b[1]=='6')||(a[0]=='e'&&a[1]=='5'&&b[0]=='c'&&b[1]=='1')||(a[0]=='d'&&a[1]=='4'&&b[0]=='b'&&b[1]=='8')||(a[0]=='b'&&a[1]=='8'&&b[0]=='a'&&b[1]=='3')||(a[0]=='e'&&a[1]=='7'&&b[0]=='e'&&b[1]=='5')||(a[0]=='b'&&a[1]=='8'&&b[0]=='c'&&*/

詳細信息


Pretests


Final Tests

Test #1:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

b4
b2

output:

2

result:

ok single line: '2'

Test #2:

score: 1
Accepted
time: 0ms
memory: 3728kb

input:

h1
h2

output:

3

result:

ok single line: '3'

Test #3:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

h1
a8

output:

6

result:

ok single line: '6'

Test #4:

score: 1
Accepted
time: 0ms
memory: 3936kb

input:

b2
f7

output:

3

result:

ok single line: '3'

Test #5:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

d5
d3

output:

2

result:

ok single line: '2'

Test #6:

score: 1
Accepted
time: 0ms
memory: 3724kb

input:

h2
a4

output:

5

result:

ok single line: '5'

Test #7:

score: 1
Accepted
time: 0ms
memory: 3968kb

input:

e8
b4

output:

3

result:

ok single line: '3'

Test #8:

score: 1
Accepted
time: 0ms
memory: 3724kb

input:

f3
c2

output:

2

result:

ok single line: '2'

Test #9:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

f4
a6

output:

3

result:

ok single line: '3'

Test #10:

score: 1
Accepted
time: 0ms
memory: 3932kb

input:

f6
g6

output:

3

result:

ok single line: '3'

Test #11:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

h4
h5

output:

3

result:

ok single line: '3'

Test #12:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

d2
g7

output:

4

result:

ok single line: '4'

Test #13:

score: 1
Accepted
time: 0ms
memory: 3724kb

input:

c1
e7

output:

4

result:

ok single line: '4'

Test #14:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

a4
h5

output:

4

result:

ok single line: '4'

Test #15:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

f2
a6

output:

3

result:

ok single line: '3'

Test #16:

score: 1
Accepted
time: 0ms
memory: 3848kb

input:

e8
d1

output:

4

result:

ok single line: '4'

Test #17:

score: 1
Accepted
time: 0ms
memory: 3936kb

input:

g3
b3

output:

3

result:

ok single line: '3'

Test #18:

score: 1
Accepted
time: 0ms
memory: 3724kb

input:

f7
h2

output:

3

result:

ok single line: '3'

Test #19:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

b8
h3

output:

5

result:

ok single line: '5'

Test #20:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

g4
a4

output:

4

result:

ok single line: '4'

Test #21:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

h7
h7

output:

0

result:

ok single line: '0'

Test #22:

score: 1
Accepted
time: 0ms
memory: 3824kb

input:

b2
b4

output:

2

result:

ok single line: '2'

Test #23:

score: 1
Accepted
time: 0ms
memory: 3932kb

input:

g2
b5

output:

4

result:

ok single line: '4'

Test #24:

score: 1
Accepted
time: 0ms
memory: 3968kb

input:

g2
g8

output:

4

result:

ok single line: '4'

Test #25:

score: 1
Accepted
time: 0ms
memory: 3872kb

input:

e1
a2

output:

3

result:

ok single line: '3'

Test #26:

score: 1
Accepted
time: 0ms
memory: 3724kb

input:

b2
e8

output:

3

result:

ok single line: '3'

Test #27:

score: 1
Accepted
time: 0ms
memory: 3776kb

input:

e2
c4

output:

4

result:

ok single line: '4'

Test #28:

score: 1
Accepted
time: 1ms
memory: 3720kb

input:

g1
d3

output:

3

result:

ok single line: '3'

Test #29:

score: 1
Accepted
time: 0ms
memory: 3964kb

input:

g4
d1

output:

2

result:

ok single line: '2'

Test #30:

score: 1
Accepted
time: 0ms
memory: 3840kb

input:

g1
e5

output:

2

result:

ok single line: '2'

Test #31:

score: 1
Accepted
time: 0ms
memory: 3840kb

input:

h4
f4

output:

2

result:

ok single line: '2'

Test #32:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

c2
d8

output:

3

result:

ok single line: '3'

Test #33:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

c1
g7

output:

4

result:

ok single line: '4'

Test #34:

score: 1
Accepted
time: 0ms
memory: 3872kb

input:

g8
b1

output:

4

result:

ok single line: '4'

Test #35:

score: 1
Accepted
time: 0ms
memory: 3868kb

input:

a7
c5

output:

4

result:

ok single line: '4'

Test #36:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

e8
h3

output:

4

result:

ok single line: '4'

Test #37:

score: 1
Accepted
time: 0ms
memory: 3844kb

input:

h8
c8

output:

3

result:

ok single line: '3'

Test #38:

score: 1
Accepted
time: 0ms
memory: 3724kb

input:

g8
c5

output:

3

result:

ok single line: '3'

Test #39:

score: 1
Accepted
time: 0ms
memory: 3776kb

input:

a7
b8

output:

2

result:

ok single line: '2'

Test #40:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

a6
g4

output:

4

result:

ok single line: '4'

Test #41:

score: 1
Accepted
time: 0ms
memory: 3908kb

input:

c8
g3

output:

3

result:

ok single line: '3'

Test #42:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

h8
e2

output:

3

result:

ok single line: '3'

Test #43:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

f4
g4

output:

3

result:

ok single line: '3'

Test #44:

score: 1
Accepted
time: 0ms
memory: 3868kb

input:

e2
a3

output:

3

result:

ok single line: '3'

Test #45:

score: 1
Accepted
time: 0ms
memory: 3920kb

input:

a3
h3

output:

5

result:

ok single line: '5'

Test #46:

score: 1
Accepted
time: 0ms
memory: 3908kb

input:

g6
h2

output:

3

result:

ok single line: '3'

Test #47:

score: 1
Accepted
time: 0ms
memory: 3968kb

input:

g3
g8

output:

3

result:

ok single line: '3'

Test #48:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

g6
c1

output:

3

result:

ok single line: '3'

Test #49:

score: 1
Accepted
time: 0ms
memory: 3868kb

input:

a8
b8

output:

3

result:

ok single line: '3'

Test #50:

score: 1
Accepted
time: 0ms
memory: 3728kb

input:

e8
c2

output:

4

result:

ok single line: '4'

Test #51:

score: 1
Accepted
time: 0ms
memory: 3848kb

input:

d4
b2

output:

4

result:

ok single line: '4'

Test #52:

score: 1
Accepted
time: 0ms
memory: 3872kb

input:

g7
b1

output:

5

result:

ok single line: '5'

Test #53:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

b2
f4

output:

2

result:

ok single line: '2'

Test #54:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

h5
a1

output:

5

result:

ok single line: '5'

Test #55:

score: 1
Accepted
time: 0ms
memory: 3908kb

input:

b1
e8

output:

4

result:

ok single line: '4'

Test #56:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

g7
h4

output:

2

result:

ok single line: '2'

Test #57:

score: 1
Accepted
time: 0ms
memory: 3840kb

input:

h4
g8

output:

3

result:

ok single line: '3'

Test #58:

score: 1
Accepted
time: 0ms
memory: 3848kb

input:

f6
f4

output:

2

result:

ok single line: '2'

Test #59:

score: 1
Accepted
time: 0ms
memory: 3968kb

input:

d2
d5

output:

3

result:

ok single line: '3'

Test #60:

score: 1
Accepted
time: 0ms
memory: 3916kb

input:

g4
b6

output:

3

result:

ok single line: '3'

Test #61:

score: 1
Accepted
time: 0ms
memory: 3728kb

input:

e1
c8

output:

5

result:

ok single line: '5'

Test #62:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

f3
d4

output:

1

result:

ok single line: '1'

Test #63:

score: 1
Accepted
time: 0ms
memory: 3848kb

input:

a7
b5

output:

1

result:

ok single line: '1'

Test #64:

score: 1
Accepted
time: 0ms
memory: 3908kb

input:

h4
g7

output:

2

result:

ok single line: '2'

Test #65:

score: 1
Accepted
time: 0ms
memory: 3864kb

input:

h3
a3

output:

5

result:

ok single line: '5'

Test #66:

score: 1
Accepted
time: 0ms
memory: 3932kb

input:

h7
d4

output:

3

result:

ok single line: '3'

Test #67:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

a3
h4

output:

4

result:

ok single line: '4'

Test #68:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

d7
e5

output:

1

result:

ok single line: '1'

Test #69:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

f4
h6

output:

4

result:

ok single line: '4'

Test #70:

score: 1
Accepted
time: 0ms
memory: 3868kb

input:

d8
c8

output:

3

result:

ok single line: '3'

Test #71:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

e1
a4

output:

3

result:

ok single line: '3'

Test #72:

score: 1
Accepted
time: 0ms
memory: 3848kb

input:

g2
a3

output:

3

result:

ok single line: '3'

Test #73:

score: 1
Accepted
time: 0ms
memory: 3916kb

input:

f6
d1

output:

3

result:

ok single line: '3'

Test #74:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

e1
h4

output:

2

result:

ok single line: '2'

Test #75:

score: 1
Accepted
time: 0ms
memory: 3932kb

input:

h7
f8

output:

1

result:

ok single line: '1'

Test #76:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

d7
c6

output:

2

result:

ok single line: '2'

Test #77:

score: 1
Accepted
time: 0ms
memory: 3776kb

input:

e5
c1

output:

2

result:

ok single line: '2'

Test #78:

score: 1
Accepted
time: 0ms
memory: 3908kb

input:

f1
d2

output:

1

result:

ok single line: '1'

Test #79:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

b3
h6

output:

3

result:

ok single line: '3'

Test #80:

score: 1
Accepted
time: 0ms
memory: 3844kb

input:

e7
g2

output:

3

result:

ok single line: '3'

Test #81:

score: 1
Accepted
time: 0ms
memory: 3912kb

input:

h3
e5

output:

3

result:

ok single line: '3'

Test #82:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

c3
h2

output:

4

result:

ok single line: '4'

Test #83:

score: 1
Accepted
time: 0ms
memory: 3968kb

input:

d4
b8

output:

2

result:

ok single line: '2'

Test #84:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

c2
e5

output:

3

result:

ok single line: '3'

Test #85:

score: 1
Accepted
time: 0ms
memory: 3600kb

input:

b8
a3

output:

4

result:

ok single line: '4'

Test #86:

score: 1
Accepted
time: 0ms
memory: 3804kb

input:

e5
h8

output:

2

result:

ok single line: '2'

Test #87:

score: 1
Accepted
time: 0ms
memory: 3872kb

input:

g5
g2

output:

3

result:

ok single line: '3'

Test #88:

score: 1
Accepted
time: 0ms
memory: 3888kb

input:

f3
a1

output:

3

result:

ok single line: '3'

Test #89:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

e7
e5

output:

2

result:

ok single line: '2'

Test #90:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

f3
c3

output:

3

result:

ok single line: '3'

Test #91:

score: 1
Accepted
time: 0ms
memory: 3916kb

input:

g5
e6

output:

1

result:

ok single line: '1'

Test #92:

score: 1
Accepted
time: 0ms
memory: 3708kb

input:

e7
e6

output:

3

result:

ok single line: '3'

Test #93:

score: 1
Accepted
time: 0ms
memory: 3908kb

input:

a4
d6

output:

3

result:

ok single line: '3'

Test #94:

score: 1
Accepted
time: 0ms
memory: 3732kb

input:

b6
h6

output:

4

result:

ok single line: '4'

Test #95:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

b7
b2

output:

3

result:

ok single line: '3'

Test #96:

score: 1
Accepted
time: 0ms
memory: 3928kb

input:

a6
f2

output:

3

result:

ok single line: '3'

Test #97:

score: 1
Accepted
time: 0ms
memory: 3924kb

input:

b2
e2

output:

3

result:

ok single line: '3'

Test #98:

score: 1
Accepted
time: 0ms
memory: 3972kb

input:

e4
d4

output:

3

result:

ok single line: '3'

Test #99:

score: 1
Accepted
time: 0ms
memory: 3968kb

input:

b8
c7

output:

2

result:

ok single line: '2'

Test #100:

score: 1
Accepted
time: 0ms
memory: 3864kb

input:

a1
h8

output:

6

result:

ok single line: '6'