-
Notifications
You must be signed in to change notification settings - Fork 0
/
6.cpp
36 lines (27 loc) · 768 Bytes
/
6.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <bits/stdc++.h>
using namespace std;
int main(){
string pos;
cin>>pos;
string alph = "ABCDEFGH12345678-";
if(pos.length() != 5) {
cout<<"ERROR";
return 0;
}
for(int i = 0; i < 5; i++){
char a = pos[i];
int p = alph.find(a);
if(p == string::npos)
cout<<"ERROR";
else
continue;
//cout<<a <<" ";
return 0;
}
int x1 = (int)pos[0], x2 = (int)pos[3], y1 = pos[1] - '0', y2 = pos[4]-'0';
//cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<< " ";
if((abs(x1 - x2) == 1 && abs(y1 - y2) == 2) || ( abs(x1-x2) == 2 && abs(y1-y2) == 1))
cout<<"YES";
else
cout<<"NO";
}