Advertisement
momo2345

Digit palindrome

Jul 22nd, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define op ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  4. int main()
  5. {
  6.     op;
  7.     int t;
  8.     cin>>t;
  9.     while(t--){
  10.         string ss;
  11.         cin>>ss;
  12.         int s=0;
  13.         for(auto u : ss)
  14.            s+=(u-'0');
  15.         string p =to_string(s);
  16.         string tm =p;
  17.         reverse(tm.begin(),tm.end());
  18.         cout<<(tm== p ? "YES" : "NO")<<"\n";
  19.        
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement