Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <sstream>
- #include <stdlib.h>
- #include <algorithm>
- #include <math.h>
- #include <time.h>
- #include <windows.h>
- using namespace std;
- int main()
- {
- string number;
- cin>>number;
- int l = number.length();
- int l2 = 0;
- bool stop=false;
- for(int i=l-1; i>=0; i--){
- if( number[i]=='0' && stop==false )continue;
- else stop=true;
- if( number[i]==number[l2] && stop==true ){
- l2++;
- }
- else if( number[i]!=number[l2] && stop==true ){
- cout<<"NO";
- break;
- }
- if( i==l2 || l2+1==i){
- cout<<"YES";
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement