Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int Pal(char s[])
- {
- int n,i,j;
- n= strlen(s);
- i=0;j=n-1;
- while(i< j)
- {
- if(s[i]!=s[j])
- return 0;
- else
- {
- i++;
- j--;
- }
- }
- return 1;
- }
- char s[300], t[300], *p;
- int main()
- {
- int k = 0,i,n;
- cin>>n;
- cin.get();
- for(i = 1; i <= n; i++)
- {
- cin.getline(s, 100);
- for(i = 0; s[i]; i++)
- {
- if(s[i]!= ' ')
- t[k++]=s[i];
- }
- t[k++]=NULL;
- if(Pal(t)==1) cout << "1"<< "\n";
- else cout << "0" << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement