Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- string str;
- cin >> str;
- int n = str.size();
- if(n!=5){
- cout << "ERROR";
- return 0;
- }
- if(str[0]!= str[3]){
- if(str[1] - str[4] == 2 || str[1]- str[4] == - 2){
- if(str[1] >='9' || str[4] >='9'){
- if(str[0] && str[3] <= 'H'){
- if(str[1] && str[4] <='8'){
- cout << "YES";
- }
- }else{
- cout << "ERROR";
- }
- }else{
- cout << "ERROR";
- }
- }else{
- cout << "NO";
- }
- }else{
- cout << "NO";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement