Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.     string str;
  9.     cin >> str;
  10.     int n = str.size();
  11.     if(n!=5){
  12.         cout << "ERROR";
  13.         return 0;
  14.     }
  15.     if(str[0]!= str[3]){
  16.             if(str[1] - str[4] == 2 || str[1]- str[4] == - 2){
  17.                     if(str[1] >='9' || str[4] >='9'){
  18.                    
  19.                    
  20.                         if(str[0] && str[3] <= 'H'){
  21.                             if(str[1] && str[4] <='8'){
  22.                                 cout << "YES";
  23.                             }
  24.                     }else{
  25.                         cout << "ERROR";
  26.                     }
  27.                 }else{
  28.                     cout << "ERROR";
  29.                 }
  30.             }else{
  31.                 cout << "NO";
  32.             }
  33.     }else{
  34.         cout << "NO";
  35.     }
  36.  
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement