SHARE
TWEET

lightoj -1225 - Palindromic Numbers (II)

jakaria_hossain Aug 22nd, 2019 75 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top