Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <sstream>
  4. #include <stdlib.h>
  5. #include <algorithm>
  6. #include <math.h>
  7. #include <time.h>
  8. #include <windows.h>
  9. using namespace std;
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. int main()
  18. {
  19.     string number;
  20.     cin>>number;
  21.     int l = number.length();
  22.     int l2 = 0;
  23.     bool stop=false;
  24.     for(int i=l-1; i>=0; i--){
  25.         if( number[i]=='0' && stop==false )continue;
  26.         else stop=true;
  27.         if( number[i]==number[l2] && stop==true ){
  28.                                                   l2++;
  29.                                                  }
  30.         else if( number[i]!=number[l2] && stop==true ){
  31.                                                        cout<<"NO";
  32.                                                        break;
  33.                                                       }
  34.         if( i==l2 || l2+1==i){
  35.                               cout<<"YES";
  36.                               break;
  37.                              }
  38.     }
  39.  
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement