jakaria_hossain

lightoj -1225 - Palindromic Numbers (II)

Aug 22nd, 2019
121
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6. int ts;
  7. cin>>ts;
  8. cin.ignore();
  9. for(int t=1;t<=ts;t++)
  10. {
  11. string s;
  12. int i,j;
  13. getline(cin,s);
  14. i=0,j=s.size()-1;
  15. while(i<=j)
  16. {
  17. if(s[i]!=s[j])break;
  18. i++;
  19. j--;
  20. }
  21. if(i<=j)printf("Case %d: No\n",t);
  22. else printf("Case %d: Yes\n",t);
  23. }
  24. }
RAW Paste Data