fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <bits/stdc++.h>
  6. using namespace std;
  7.  
  8. int main() {
  9. long long n;
  10. string str="", str1="";
  11. cin >> n;
  12. while (n%10 == 0 && n>0) n/=10;
  13. while (n>0) {str+=char(n%10 + '0'); n/=10;}
  14. str1=str;
  15. reverse(str.begin(), str.end());
  16. if (str==str1) cout << "YES";
  17. else cout << "NO";
  18. }
Success #stdin #stdout 0s 16064KB
stdin
131
stdout
YES