Advertisement
Zuneve

wadadahreew hvbsiuhvwkhbgysnofvi54sghfniy ouejpihfh0ijn

Oct 16th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. using namespace std;
  5. int main() {
  6. string s;
  7. cin >> s;
  8. if (abs(s[0]-s[3])==2 and abs(int(s[1]-s[4]))==1 or abs(s[0]-s[3])==1 and abs(int(s[1]-s[4])==2)) cout << "YES";
  9. else if (s.size()!=5 or s[0]<'A' or s[0]>'H' or s[1]<'1' or s[1]>'8' or s[2]!='-'
  10. or s[3]<'A' or s[3]>'H' or s[4]<'1' or s[4]>'8') cout << "ERROR";
  11. else cout << "NO";
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement